Rosa's TurbineBenchmark

Percentage Accurate: 84.7% → 99.4%
Time: 15.1s
Alternatives: 14
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 14 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.7% 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.4% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r} + -1.5\\
t_1 := t\_0 + \left(0.375 + v \cdot -0.25\right) \cdot \left(\left(r \cdot w\right) \cdot \frac{r \cdot w}{v}\right)\\
\mathbf{if}\;v \leq -2:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;v \leq 9.5 \cdot 10^{-6}:\\
\;\;\;\;t\_0 + \left(r \cdot w\right) \cdot \left(w \cdot \left(r \cdot -0.375\right)\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if v < -2 or 9.5000000000000005e-6 < v

    1. Initial program 85.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. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) + \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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)\right) - \frac{9}{2} \]
      2. +-commutativeN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \left(3 + \frac{2}{r \cdot r}\right)\right) - \frac{9}{2} \]
      3. associate--l+N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)} \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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), \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)}\right) \]
    3. Simplified89.9%

      \[\leadsto \color{blue}{\left(0.375 + v \cdot -0.25\right) \cdot \frac{r \cdot \left(r \cdot \left(w \cdot w\right)\right)}{v + -1} + \left(\frac{2}{r \cdot r} + -1.5\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \left(r \cdot \frac{r \cdot \left(w \cdot w\right)}{v + -1}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \color{blue}{\mathsf{*.f64}\left(r, r\right)}\right), \frac{-3}{2}\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \left(\frac{r \cdot \left(w \cdot w\right)}{v + -1} \cdot r\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \color{blue}{\mathsf{*.f64}\left(r, r\right)}\right), \frac{-3}{2}\right)\right) \]
      3. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \left(\frac{\left(r \cdot w\right) \cdot w}{v + -1} \cdot r\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
      4. associate-/l*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \left(\left(\left(r \cdot w\right) \cdot \frac{w}{v + -1}\right) \cdot r\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(\color{blue}{r}, r\right)\right), \frac{-3}{2}\right)\right) \]
      5. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \left(\left(r \cdot w\right) \cdot \left(\frac{w}{v + -1} \cdot r\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \color{blue}{\mathsf{*.f64}\left(r, r\right)}\right), \frac{-3}{2}\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \mathsf{*.f64}\left(\left(r \cdot w\right), \left(\frac{w}{v + -1} \cdot r\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \color{blue}{\mathsf{*.f64}\left(r, r\right)}\right), \frac{-3}{2}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \left(\frac{w}{v + -1} \cdot r\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(\color{blue}{r}, r\right)\right), \frac{-3}{2}\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(\left(\frac{w}{v + -1}\right), r\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, \color{blue}{r}\right)\right), \frac{-3}{2}\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(w, \left(v + -1\right)\right), r\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
      10. +-lowering-+.f6498.5%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(w, \mathsf{+.f64}\left(v, -1\right)\right), r\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
    6. Applied egg-rr98.5%

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

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \color{blue}{\left(\frac{r \cdot w}{v}\right)}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
    8. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{/.f64}\left(\left(r \cdot w\right), v\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, \color{blue}{r}\right)\right), \frac{-3}{2}\right)\right) \]
      2. *-lowering-*.f6498.6%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(r, w\right), v\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
    9. Simplified98.6%

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

    if -2 < v < 9.5000000000000005e-6

    1. Initial program 86.8%

      \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
    2. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) + \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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)\right) - \frac{9}{2} \]
      2. +-commutativeN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \left(3 + \frac{2}{r \cdot r}\right)\right) - \frac{9}{2} \]
      3. associate--l+N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)} \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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), \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)}\right) \]
    3. Simplified86.8%

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

      \[\leadsto \color{blue}{\left(\frac{-3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right) + 2 \cdot \frac{1}{{r}^{2}}\right) - \frac{3}{2}} \]
    6. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto \frac{-3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)} \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{-3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right), \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)}\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left({r}^{2} \cdot {w}^{2}\right) \cdot \frac{-3}{8}\right), \left(\color{blue}{2 \cdot \frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
      4. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(\left({r}^{2} \cdot \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2 \cdot \frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left({r}^{2}\right), \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2 \cdot \frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(r \cdot r\right), \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2} \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2} \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\left({w}^{2}\right), \frac{-3}{8}\right)\right), \left(2 \cdot \color{blue}{\frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\left(w \cdot w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{\color{blue}{1}}{{r}^{2}} - \frac{3}{2}\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{\color{blue}{1}}{{r}^{2}} - \frac{3}{2}\right)\right) \]
      11. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{1}{{r}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2}\right)\right)}\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{1}{{r}^{2}} + \frac{-3}{2}\right)\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\left(2 \cdot \frac{1}{{r}^{2}}\right), \color{blue}{\frac{-3}{2}}\right)\right) \]
      14. associate-*r/N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\left(\frac{2 \cdot 1}{{r}^{2}}\right), \frac{-3}{2}\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\left(\frac{2}{{r}^{2}}\right), \frac{-3}{2}\right)\right) \]
      16. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left({r}^{2}\right)\right), \frac{-3}{2}\right)\right) \]
      17. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left(r \cdot r\right)\right), \frac{-3}{2}\right)\right) \]
      18. *-lowering-*.f6483.3%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
    7. Simplified83.3%

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

        \[\leadsto \mathsf{+.f64}\left(\left(\left(\left(r \cdot r\right) \cdot \left(w \cdot w\right)\right) \cdot \frac{-3}{8}\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right)}, \frac{-3}{2}\right)\right) \]
      2. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right) \cdot \frac{-3}{8}\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(\color{blue}{2}, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(\left(r \cdot \left(w \cdot w\right)\right) \cdot r\right) \cdot \frac{-3}{8}\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(\color{blue}{2}, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
      4. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(r \cdot \left(w \cdot w\right)\right) \cdot \left(r \cdot \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right)}, \frac{-3}{2}\right)\right) \]
      5. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(\left(r \cdot w\right) \cdot w\right) \cdot \left(r \cdot \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(\color{blue}{2}, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(r \cdot w\right) \cdot \left(w \cdot \left(r \cdot \frac{-3}{8}\right)\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right)}, \frac{-3}{2}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(r \cdot w\right), \left(w \cdot \left(r \cdot \frac{-3}{8}\right)\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right)}, \frac{-3}{2}\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \left(w \cdot \left(r \cdot \frac{-3}{8}\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(\color{blue}{2}, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(w, \left(r \cdot \frac{-3}{8}\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \color{blue}{\mathsf{*.f64}\left(r, r\right)}\right), \frac{-3}{2}\right)\right) \]
      10. *-lowering-*.f6499.8%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(w, \mathsf{*.f64}\left(r, \frac{-3}{8}\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, \color{blue}{r}\right)\right), \frac{-3}{2}\right)\right) \]
    9. Applied egg-rr99.8%

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

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

Alternative 2: 97.9% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;v \leq 9.5 \cdot 10^{-6}:\\
\;\;\;\;t\_0 + \left(r \cdot w\right) \cdot \left(w \cdot \left(r \cdot -0.375\right)\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if v < -3.2000000000000002 or 9.5000000000000005e-6 < v

    1. Initial program 85.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. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) + \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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)\right) - \frac{9}{2} \]
      2. +-commutativeN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \left(3 + \frac{2}{r \cdot r}\right)\right) - \frac{9}{2} \]
      3. associate--l+N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)} \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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), \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)}\right) \]
    3. Simplified89.9%

      \[\leadsto \color{blue}{\left(0.375 + v \cdot -0.25\right) \cdot \frac{r \cdot \left(r \cdot \left(w \cdot w\right)\right)}{v + -1} + \left(\frac{2}{r \cdot r} + -1.5\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \left(r \cdot \frac{r \cdot \left(w \cdot w\right)}{v + -1}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \color{blue}{\mathsf{*.f64}\left(r, r\right)}\right), \frac{-3}{2}\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \left(\frac{r \cdot \left(w \cdot w\right)}{v + -1} \cdot r\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \color{blue}{\mathsf{*.f64}\left(r, r\right)}\right), \frac{-3}{2}\right)\right) \]
      3. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \left(\frac{\left(r \cdot w\right) \cdot w}{v + -1} \cdot r\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
      4. associate-/l*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \left(\left(\left(r \cdot w\right) \cdot \frac{w}{v + -1}\right) \cdot r\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(\color{blue}{r}, r\right)\right), \frac{-3}{2}\right)\right) \]
      5. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \left(\left(r \cdot w\right) \cdot \left(\frac{w}{v + -1} \cdot r\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \color{blue}{\mathsf{*.f64}\left(r, r\right)}\right), \frac{-3}{2}\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \mathsf{*.f64}\left(\left(r \cdot w\right), \left(\frac{w}{v + -1} \cdot r\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \color{blue}{\mathsf{*.f64}\left(r, r\right)}\right), \frac{-3}{2}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \left(\frac{w}{v + -1} \cdot r\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(\color{blue}{r}, r\right)\right), \frac{-3}{2}\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(\left(\frac{w}{v + -1}\right), r\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, \color{blue}{r}\right)\right), \frac{-3}{2}\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(w, \left(v + -1\right)\right), r\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
      10. +-lowering-+.f6498.5%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(w, \mathsf{+.f64}\left(v, -1\right)\right), r\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
    6. Applied egg-rr98.5%

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

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\color{blue}{\left(\frac{-1}{4} \cdot v\right)}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(w, \mathsf{+.f64}\left(v, -1\right)\right), r\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
    8. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(v \cdot \frac{-1}{4}\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(w, \mathsf{+.f64}\left(v, -1\right)\right), r\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(\color{blue}{2}, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
      2. *-lowering-*.f6497.2%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(v, \frac{-1}{4}\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(w, \mathsf{+.f64}\left(v, -1\right)\right), r\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(\color{blue}{2}, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
    9. Simplified97.2%

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

    if -3.2000000000000002 < v < 9.5000000000000005e-6

    1. Initial program 86.8%

      \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
    2. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) + \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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)\right) - \frac{9}{2} \]
      2. +-commutativeN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \left(3 + \frac{2}{r \cdot r}\right)\right) - \frac{9}{2} \]
      3. associate--l+N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)} \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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), \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)}\right) \]
    3. Simplified86.8%

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

      \[\leadsto \color{blue}{\left(\frac{-3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right) + 2 \cdot \frac{1}{{r}^{2}}\right) - \frac{3}{2}} \]
    6. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto \frac{-3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)} \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{-3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right), \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)}\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left({r}^{2} \cdot {w}^{2}\right) \cdot \frac{-3}{8}\right), \left(\color{blue}{2 \cdot \frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
      4. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(\left({r}^{2} \cdot \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2 \cdot \frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left({r}^{2}\right), \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2 \cdot \frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(r \cdot r\right), \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2} \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2} \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\left({w}^{2}\right), \frac{-3}{8}\right)\right), \left(2 \cdot \color{blue}{\frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\left(w \cdot w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{\color{blue}{1}}{{r}^{2}} - \frac{3}{2}\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{\color{blue}{1}}{{r}^{2}} - \frac{3}{2}\right)\right) \]
      11. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{1}{{r}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2}\right)\right)}\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{1}{{r}^{2}} + \frac{-3}{2}\right)\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\left(2 \cdot \frac{1}{{r}^{2}}\right), \color{blue}{\frac{-3}{2}}\right)\right) \]
      14. associate-*r/N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\left(\frac{2 \cdot 1}{{r}^{2}}\right), \frac{-3}{2}\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\left(\frac{2}{{r}^{2}}\right), \frac{-3}{2}\right)\right) \]
      16. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left({r}^{2}\right)\right), \frac{-3}{2}\right)\right) \]
      17. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left(r \cdot r\right)\right), \frac{-3}{2}\right)\right) \]
      18. *-lowering-*.f6483.3%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
    7. Simplified83.3%

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

        \[\leadsto \mathsf{+.f64}\left(\left(\left(\left(r \cdot r\right) \cdot \left(w \cdot w\right)\right) \cdot \frac{-3}{8}\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right)}, \frac{-3}{2}\right)\right) \]
      2. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right) \cdot \frac{-3}{8}\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(\color{blue}{2}, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(\left(r \cdot \left(w \cdot w\right)\right) \cdot r\right) \cdot \frac{-3}{8}\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(\color{blue}{2}, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
      4. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(r \cdot \left(w \cdot w\right)\right) \cdot \left(r \cdot \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right)}, \frac{-3}{2}\right)\right) \]
      5. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(\left(r \cdot w\right) \cdot w\right) \cdot \left(r \cdot \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(\color{blue}{2}, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(r \cdot w\right) \cdot \left(w \cdot \left(r \cdot \frac{-3}{8}\right)\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right)}, \frac{-3}{2}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(r \cdot w\right), \left(w \cdot \left(r \cdot \frac{-3}{8}\right)\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right)}, \frac{-3}{2}\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \left(w \cdot \left(r \cdot \frac{-3}{8}\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(\color{blue}{2}, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(w, \left(r \cdot \frac{-3}{8}\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \color{blue}{\mathsf{*.f64}\left(r, r\right)}\right), \frac{-3}{2}\right)\right) \]
      10. *-lowering-*.f6499.8%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(w, \mathsf{*.f64}\left(r, \frac{-3}{8}\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, \color{blue}{r}\right)\right), \frac{-3}{2}\right)\right) \]
    9. Applied egg-rr99.8%

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

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

Alternative 3: 72.3% accurate, 1.1× speedup?

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

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

\mathbf{elif}\;r \leq 10^{+143}:\\
\;\;\;\;\left(r \cdot r\right) \cdot \left(-0.375 \cdot \left(w \cdot w\right) + \frac{-1.5}{r \cdot r}\right)\\

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


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

    1. Initial program 84.8%

      \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
    2. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) + \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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)\right) - \frac{9}{2} \]
      2. +-commutativeN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \left(3 + \frac{2}{r \cdot r}\right)\right) - \frac{9}{2} \]
      3. associate--l+N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)} \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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), \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)}\right) \]
    3. Simplified86.1%

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

      \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}} \]
    6. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto 2 \cdot \frac{1}{{r}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2}\right)\right)} \]
      2. metadata-evalN/A

        \[\leadsto 2 \cdot \frac{1}{{r}^{2}} + \frac{-3}{2} \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(2 \cdot \frac{1}{{r}^{2}}\right), \color{blue}{\frac{-3}{2}}\right) \]
      4. associate-*r/N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{2 \cdot 1}{{r}^{2}}\right), \frac{-3}{2}\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{2}{{r}^{2}}\right), \frac{-3}{2}\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left({r}^{2}\right)\right), \frac{-3}{2}\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left(r \cdot r\right)\right), \frac{-3}{2}\right) \]
      8. *-lowering-*.f6464.8%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right) \]
    7. Simplified64.8%

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

    if 6.9999999999999994e-5 < r < 1e143

    1. Initial program 89.6%

      \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
    2. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) + \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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)\right) - \frac{9}{2} \]
      2. +-commutativeN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \left(3 + \frac{2}{r \cdot r}\right)\right) - \frac{9}{2} \]
      3. associate--l+N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)} \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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), \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)}\right) \]
    3. Simplified99.7%

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

      \[\leadsto \color{blue}{\left(\frac{-3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right) + 2 \cdot \frac{1}{{r}^{2}}\right) - \frac{3}{2}} \]
    6. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto \frac{-3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)} \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{-3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right), \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)}\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left({r}^{2} \cdot {w}^{2}\right) \cdot \frac{-3}{8}\right), \left(\color{blue}{2 \cdot \frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
      4. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(\left({r}^{2} \cdot \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2 \cdot \frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left({r}^{2}\right), \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2 \cdot \frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(r \cdot r\right), \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2} \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2} \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\left({w}^{2}\right), \frac{-3}{8}\right)\right), \left(2 \cdot \color{blue}{\frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\left(w \cdot w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{\color{blue}{1}}{{r}^{2}} - \frac{3}{2}\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{\color{blue}{1}}{{r}^{2}} - \frac{3}{2}\right)\right) \]
      11. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{1}{{r}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2}\right)\right)}\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{1}{{r}^{2}} + \frac{-3}{2}\right)\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\left(2 \cdot \frac{1}{{r}^{2}}\right), \color{blue}{\frac{-3}{2}}\right)\right) \]
      14. associate-*r/N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\left(\frac{2 \cdot 1}{{r}^{2}}\right), \frac{-3}{2}\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\left(\frac{2}{{r}^{2}}\right), \frac{-3}{2}\right)\right) \]
      16. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left({r}^{2}\right)\right), \frac{-3}{2}\right)\right) \]
      17. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left(r \cdot r\right)\right), \frac{-3}{2}\right)\right) \]
      18. *-lowering-*.f6491.0%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
    7. Simplified91.0%

      \[\leadsto \color{blue}{\left(r \cdot r\right) \cdot \left(\left(w \cdot w\right) \cdot -0.375\right) + \left(\frac{2}{r \cdot r} + -1.5\right)} \]
    8. Taylor expanded in r around inf

      \[\leadsto \color{blue}{{r}^{2} \cdot \left(\frac{-3}{8} \cdot {w}^{2} - \frac{3}{2} \cdot \frac{1}{{r}^{2}}\right)} \]
    9. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left({r}^{2}\right), \color{blue}{\left(\frac{-3}{8} \cdot {w}^{2} - \frac{3}{2} \cdot \frac{1}{{r}^{2}}\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\left(r \cdot r\right), \left(\color{blue}{\frac{-3}{8} \cdot {w}^{2}} - \frac{3}{2} \cdot \frac{1}{{r}^{2}}\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \left(\color{blue}{\frac{-3}{8} \cdot {w}^{2}} - \frac{3}{2} \cdot \frac{1}{{r}^{2}}\right)\right) \]
      4. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \left(\frac{-3}{8} \cdot {w}^{2} + \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2} \cdot \frac{1}{{r}^{2}}\right)\right)}\right)\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\left(\frac{-3}{8} \cdot {w}^{2}\right), \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2} \cdot \frac{1}{{r}^{2}}\right)\right)}\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \left({w}^{2}\right)\right), \left(\mathsf{neg}\left(\color{blue}{\frac{3}{2} \cdot \frac{1}{{r}^{2}}}\right)\right)\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \left(w \cdot w\right)\right), \left(\mathsf{neg}\left(\frac{3}{2} \cdot \color{blue}{\frac{1}{{r}^{2}}}\right)\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \mathsf{*.f64}\left(w, w\right)\right), \left(\mathsf{neg}\left(\frac{3}{2} \cdot \color{blue}{\frac{1}{{r}^{2}}}\right)\right)\right)\right) \]
      9. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \mathsf{*.f64}\left(w, w\right)\right), \left(\mathsf{neg}\left(\frac{\frac{3}{2} \cdot 1}{{r}^{2}}\right)\right)\right)\right) \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \mathsf{*.f64}\left(w, w\right)\right), \left(\mathsf{neg}\left(\frac{\frac{3}{2}}{{r}^{2}}\right)\right)\right)\right) \]
      11. distribute-neg-fracN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \mathsf{*.f64}\left(w, w\right)\right), \left(\frac{\mathsf{neg}\left(\frac{3}{2}\right)}{\color{blue}{{r}^{2}}}\right)\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \mathsf{*.f64}\left(w, w\right)\right), \left(\frac{\frac{-3}{2}}{{\color{blue}{r}}^{2}}\right)\right)\right) \]
      13. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \mathsf{*.f64}\left(w, w\right)\right), \mathsf{/.f64}\left(\frac{-3}{2}, \color{blue}{\left({r}^{2}\right)}\right)\right)\right) \]
      14. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \mathsf{*.f64}\left(w, w\right)\right), \mathsf{/.f64}\left(\frac{-3}{2}, \left(r \cdot \color{blue}{r}\right)\right)\right)\right) \]
      15. *-lowering-*.f6491.0%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \mathsf{*.f64}\left(w, w\right)\right), \mathsf{/.f64}\left(\frac{-3}{2}, \mathsf{*.f64}\left(r, \color{blue}{r}\right)\right)\right)\right) \]
    10. Simplified91.0%

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

    if 1e143 < r

    1. Initial program 90.4%

      \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
    2. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) + \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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)\right) - \frac{9}{2} \]
      2. +-commutativeN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \left(3 + \frac{2}{r \cdot r}\right)\right) - \frac{9}{2} \]
      3. associate--l+N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)} \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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), \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)}\right) \]
    3. Simplified93.2%

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

      \[\leadsto \color{blue}{\frac{{r}^{2} \cdot \left({w}^{2} \cdot \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right)}{v - 1}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left({r}^{2} \cdot \left({w}^{2} \cdot \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right)\right), \color{blue}{\left(v - 1\right)}\right) \]
      2. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\left({r}^{2} \cdot {w}^{2}\right) \cdot \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(\color{blue}{v} - 1\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left({r}^{2} \cdot {w}^{2}\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(\color{blue}{v} - 1\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\left(r \cdot r\right) \cdot {w}^{2}\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      5. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(r \cdot \left(r \cdot {w}^{2}\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \left(r \cdot {w}^{2}\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \left({w}^{2}\right)\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      8. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \left(w \cdot w\right)\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \left(\frac{-1}{4} \cdot v\right)\right)\right), \left(v - 1\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \left(v \cdot \frac{-1}{4}\right)\right)\right), \left(v - 1\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \left(v - 1\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \left(v + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right) \]
      14. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \left(v + -1\right)\right) \]
      15. +-lowering-+.f6477.6%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \mathsf{+.f64}\left(v, \color{blue}{-1}\right)\right) \]
    7. Simplified77.6%

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

        \[\leadsto \left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right) \cdot \color{blue}{\frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1}} \]
      2. *-commutativeN/A

        \[\leadsto \frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1} \cdot \color{blue}{\left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right)} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1} \cdot \left(\left(r \cdot \left(w \cdot w\right)\right) \cdot \color{blue}{r}\right) \]
      4. associate-*r*N/A

        \[\leadsto \frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1} \cdot \left(\left(\left(r \cdot w\right) \cdot w\right) \cdot r\right) \]
      5. associate-*l*N/A

        \[\leadsto \frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1} \cdot \left(\left(r \cdot w\right) \cdot \color{blue}{\left(w \cdot r\right)}\right) \]
      6. *-commutativeN/A

        \[\leadsto \frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1} \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot \color{blue}{w}\right)\right) \]
      7. associate-*r*N/A

        \[\leadsto \left(\frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1} \cdot \left(r \cdot w\right)\right) \cdot \color{blue}{\left(r \cdot w\right)} \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1} \cdot \left(r \cdot w\right)\right), \color{blue}{\left(r \cdot w\right)}\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1}\right), \left(r \cdot w\right)\right), \left(\color{blue}{r} \cdot w\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{3}{8} + v \cdot \frac{-1}{4}\right), \left(v + -1\right)\right), \left(r \cdot w\right)\right), \left(r \cdot w\right)\right) \]
      11. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \left(v \cdot \frac{-1}{4}\right)\right), \left(v + -1\right)\right), \left(r \cdot w\right)\right), \left(r \cdot w\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \left(v + -1\right)\right), \left(r \cdot w\right)\right), \left(r \cdot w\right)\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \mathsf{+.f64}\left(v, -1\right)\right), \left(r \cdot w\right)\right), \left(r \cdot w\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \mathsf{+.f64}\left(v, -1\right)\right), \mathsf{*.f64}\left(r, w\right)\right), \left(r \cdot w\right)\right) \]
      15. *-lowering-*.f6485.4%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \mathsf{+.f64}\left(v, -1\right)\right), \mathsf{*.f64}\left(r, w\right)\right), \mathsf{*.f64}\left(r, \color{blue}{w}\right)\right) \]
    9. Applied egg-rr85.4%

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

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

Alternative 4: 71.3% accurate, 1.1× speedup?

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

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

\mathbf{elif}\;r \leq 2.7 \cdot 10^{+143}:\\
\;\;\;\;\left(r \cdot r\right) \cdot \left(-0.375 \cdot \left(w \cdot w\right) + \frac{-1.5}{r \cdot r}\right)\\

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


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

    1. Initial program 84.8%

      \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
    2. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) + \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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)\right) - \frac{9}{2} \]
      2. +-commutativeN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \left(3 + \frac{2}{r \cdot r}\right)\right) - \frac{9}{2} \]
      3. associate--l+N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)} \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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), \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)}\right) \]
    3. Simplified86.1%

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

      \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}} \]
    6. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto 2 \cdot \frac{1}{{r}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2}\right)\right)} \]
      2. metadata-evalN/A

        \[\leadsto 2 \cdot \frac{1}{{r}^{2}} + \frac{-3}{2} \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(2 \cdot \frac{1}{{r}^{2}}\right), \color{blue}{\frac{-3}{2}}\right) \]
      4. associate-*r/N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{2 \cdot 1}{{r}^{2}}\right), \frac{-3}{2}\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{2}{{r}^{2}}\right), \frac{-3}{2}\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left({r}^{2}\right)\right), \frac{-3}{2}\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left(r \cdot r\right)\right), \frac{-3}{2}\right) \]
      8. *-lowering-*.f6464.8%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right) \]
    7. Simplified64.8%

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

    if 7.7999999999999999e-5 < r < 2.7000000000000002e143

    1. Initial program 89.6%

      \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
    2. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) + \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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)\right) - \frac{9}{2} \]
      2. +-commutativeN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \left(3 + \frac{2}{r \cdot r}\right)\right) - \frac{9}{2} \]
      3. associate--l+N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)} \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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), \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)}\right) \]
    3. Simplified99.7%

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

      \[\leadsto \color{blue}{\left(\frac{-3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right) + 2 \cdot \frac{1}{{r}^{2}}\right) - \frac{3}{2}} \]
    6. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto \frac{-3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)} \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{-3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right), \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)}\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left({r}^{2} \cdot {w}^{2}\right) \cdot \frac{-3}{8}\right), \left(\color{blue}{2 \cdot \frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
      4. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(\left({r}^{2} \cdot \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2 \cdot \frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left({r}^{2}\right), \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2 \cdot \frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(r \cdot r\right), \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2} \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2} \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\left({w}^{2}\right), \frac{-3}{8}\right)\right), \left(2 \cdot \color{blue}{\frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\left(w \cdot w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{\color{blue}{1}}{{r}^{2}} - \frac{3}{2}\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{\color{blue}{1}}{{r}^{2}} - \frac{3}{2}\right)\right) \]
      11. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{1}{{r}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2}\right)\right)}\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{1}{{r}^{2}} + \frac{-3}{2}\right)\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\left(2 \cdot \frac{1}{{r}^{2}}\right), \color{blue}{\frac{-3}{2}}\right)\right) \]
      14. associate-*r/N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\left(\frac{2 \cdot 1}{{r}^{2}}\right), \frac{-3}{2}\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\left(\frac{2}{{r}^{2}}\right), \frac{-3}{2}\right)\right) \]
      16. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left({r}^{2}\right)\right), \frac{-3}{2}\right)\right) \]
      17. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left(r \cdot r\right)\right), \frac{-3}{2}\right)\right) \]
      18. *-lowering-*.f6491.0%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
    7. Simplified91.0%

      \[\leadsto \color{blue}{\left(r \cdot r\right) \cdot \left(\left(w \cdot w\right) \cdot -0.375\right) + \left(\frac{2}{r \cdot r} + -1.5\right)} \]
    8. Taylor expanded in r around inf

      \[\leadsto \color{blue}{{r}^{2} \cdot \left(\frac{-3}{8} \cdot {w}^{2} - \frac{3}{2} \cdot \frac{1}{{r}^{2}}\right)} \]
    9. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left({r}^{2}\right), \color{blue}{\left(\frac{-3}{8} \cdot {w}^{2} - \frac{3}{2} \cdot \frac{1}{{r}^{2}}\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\left(r \cdot r\right), \left(\color{blue}{\frac{-3}{8} \cdot {w}^{2}} - \frac{3}{2} \cdot \frac{1}{{r}^{2}}\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \left(\color{blue}{\frac{-3}{8} \cdot {w}^{2}} - \frac{3}{2} \cdot \frac{1}{{r}^{2}}\right)\right) \]
      4. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \left(\frac{-3}{8} \cdot {w}^{2} + \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2} \cdot \frac{1}{{r}^{2}}\right)\right)}\right)\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\left(\frac{-3}{8} \cdot {w}^{2}\right), \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2} \cdot \frac{1}{{r}^{2}}\right)\right)}\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \left({w}^{2}\right)\right), \left(\mathsf{neg}\left(\color{blue}{\frac{3}{2} \cdot \frac{1}{{r}^{2}}}\right)\right)\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \left(w \cdot w\right)\right), \left(\mathsf{neg}\left(\frac{3}{2} \cdot \color{blue}{\frac{1}{{r}^{2}}}\right)\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \mathsf{*.f64}\left(w, w\right)\right), \left(\mathsf{neg}\left(\frac{3}{2} \cdot \color{blue}{\frac{1}{{r}^{2}}}\right)\right)\right)\right) \]
      9. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \mathsf{*.f64}\left(w, w\right)\right), \left(\mathsf{neg}\left(\frac{\frac{3}{2} \cdot 1}{{r}^{2}}\right)\right)\right)\right) \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \mathsf{*.f64}\left(w, w\right)\right), \left(\mathsf{neg}\left(\frac{\frac{3}{2}}{{r}^{2}}\right)\right)\right)\right) \]
      11. distribute-neg-fracN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \mathsf{*.f64}\left(w, w\right)\right), \left(\frac{\mathsf{neg}\left(\frac{3}{2}\right)}{\color{blue}{{r}^{2}}}\right)\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \mathsf{*.f64}\left(w, w\right)\right), \left(\frac{\frac{-3}{2}}{{\color{blue}{r}}^{2}}\right)\right)\right) \]
      13. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \mathsf{*.f64}\left(w, w\right)\right), \mathsf{/.f64}\left(\frac{-3}{2}, \color{blue}{\left({r}^{2}\right)}\right)\right)\right) \]
      14. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \mathsf{*.f64}\left(w, w\right)\right), \mathsf{/.f64}\left(\frac{-3}{2}, \left(r \cdot \color{blue}{r}\right)\right)\right)\right) \]
      15. *-lowering-*.f6491.0%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \mathsf{*.f64}\left(w, w\right)\right), \mathsf{/.f64}\left(\frac{-3}{2}, \mathsf{*.f64}\left(r, \color{blue}{r}\right)\right)\right)\right) \]
    10. Simplified91.0%

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

    if 2.7000000000000002e143 < r

    1. Initial program 90.4%

      \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
    2. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) + \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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)\right) - \frac{9}{2} \]
      2. +-commutativeN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \left(3 + \frac{2}{r \cdot r}\right)\right) - \frac{9}{2} \]
      3. associate--l+N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)} \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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), \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)}\right) \]
    3. Simplified93.2%

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

      \[\leadsto \color{blue}{\frac{{r}^{2} \cdot \left({w}^{2} \cdot \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right)}{v - 1}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left({r}^{2} \cdot \left({w}^{2} \cdot \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right)\right), \color{blue}{\left(v - 1\right)}\right) \]
      2. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\left({r}^{2} \cdot {w}^{2}\right) \cdot \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(\color{blue}{v} - 1\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left({r}^{2} \cdot {w}^{2}\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(\color{blue}{v} - 1\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\left(r \cdot r\right) \cdot {w}^{2}\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      5. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(r \cdot \left(r \cdot {w}^{2}\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \left(r \cdot {w}^{2}\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \left({w}^{2}\right)\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      8. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \left(w \cdot w\right)\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \left(\frac{-1}{4} \cdot v\right)\right)\right), \left(v - 1\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \left(v \cdot \frac{-1}{4}\right)\right)\right), \left(v - 1\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \left(v - 1\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \left(v + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right) \]
      14. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \left(v + -1\right)\right) \]
      15. +-lowering-+.f6477.6%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \mathsf{+.f64}\left(v, \color{blue}{-1}\right)\right) \]
    7. Simplified77.6%

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

        \[\leadsto \left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right) \cdot \color{blue}{\frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1}} \]
      2. *-commutativeN/A

        \[\leadsto \left(\left(r \cdot \left(w \cdot w\right)\right) \cdot r\right) \cdot \frac{\color{blue}{\frac{3}{8} + v \cdot \frac{-1}{4}}}{v + -1} \]
      3. associate-*l*N/A

        \[\leadsto \left(r \cdot \left(w \cdot w\right)\right) \cdot \color{blue}{\left(r \cdot \frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1}\right)} \]
      4. associate-*r*N/A

        \[\leadsto \left(\left(r \cdot w\right) \cdot w\right) \cdot \left(\color{blue}{r} \cdot \frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1}\right) \]
      5. associate-*l*N/A

        \[\leadsto \left(r \cdot w\right) \cdot \color{blue}{\left(w \cdot \left(r \cdot \frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1}\right)\right)} \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(r \cdot w\right), \color{blue}{\left(w \cdot \left(r \cdot \frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1}\right)\right)}\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \left(\color{blue}{w} \cdot \left(r \cdot \frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1}\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(w, \color{blue}{\left(r \cdot \frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1}\right)}\right)\right) \]
      9. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(w, \left(\frac{r \cdot \left(\frac{3}{8} + v \cdot \frac{-1}{4}\right)}{\color{blue}{v + -1}}\right)\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(w, \mathsf{/.f64}\left(\left(r \cdot \left(\frac{3}{8} + v \cdot \frac{-1}{4}\right)\right), \color{blue}{\left(v + -1\right)}\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(w, \mathsf{/.f64}\left(\mathsf{*.f64}\left(r, \left(\frac{3}{8} + v \cdot \frac{-1}{4}\right)\right), \left(\color{blue}{v} + -1\right)\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(w, \mathsf{/.f64}\left(\mathsf{*.f64}\left(r, \mathsf{+.f64}\left(\frac{3}{8}, \left(v \cdot \frac{-1}{4}\right)\right)\right), \left(v + -1\right)\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(w, \mathsf{/.f64}\left(\mathsf{*.f64}\left(r, \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \left(v + -1\right)\right)\right)\right) \]
      14. +-lowering-+.f6482.4%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(w, \mathsf{/.f64}\left(\mathsf{*.f64}\left(r, \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \mathsf{+.f64}\left(v, \color{blue}{-1}\right)\right)\right)\right) \]
    9. Applied egg-rr82.4%

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

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

Alternative 5: 70.9% accurate, 1.2× speedup?

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

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

\mathbf{elif}\;r \leq 7.4 \cdot 10^{+152}:\\
\;\;\;\;\left(r \cdot r\right) \cdot \left(-0.375 \cdot \left(w \cdot w\right) + \frac{-1.5}{r \cdot r}\right)\\

\mathbf{else}:\\
\;\;\;\;\left(r \cdot w\right) \cdot \left(r \cdot \left(-0.25 \cdot w\right)\right)\\


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

    1. Initial program 84.8%

      \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
    2. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) + \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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)\right) - \frac{9}{2} \]
      2. +-commutativeN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \left(3 + \frac{2}{r \cdot r}\right)\right) - \frac{9}{2} \]
      3. associate--l+N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)} \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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), \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)}\right) \]
    3. Simplified86.1%

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

      \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}} \]
    6. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto 2 \cdot \frac{1}{{r}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2}\right)\right)} \]
      2. metadata-evalN/A

        \[\leadsto 2 \cdot \frac{1}{{r}^{2}} + \frac{-3}{2} \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(2 \cdot \frac{1}{{r}^{2}}\right), \color{blue}{\frac{-3}{2}}\right) \]
      4. associate-*r/N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{2 \cdot 1}{{r}^{2}}\right), \frac{-3}{2}\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{2}{{r}^{2}}\right), \frac{-3}{2}\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left({r}^{2}\right)\right), \frac{-3}{2}\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left(r \cdot r\right)\right), \frac{-3}{2}\right) \]
      8. *-lowering-*.f6464.8%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right) \]
    7. Simplified64.8%

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

    if 7.39999999999999962e-5 < r < 7.39999999999999992e152

    1. Initial program 89.6%

      \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
    2. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) + \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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)\right) - \frac{9}{2} \]
      2. +-commutativeN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \left(3 + \frac{2}{r \cdot r}\right)\right) - \frac{9}{2} \]
      3. associate--l+N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)} \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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), \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)}\right) \]
    3. Simplified99.7%

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

      \[\leadsto \color{blue}{\left(\frac{-3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right) + 2 \cdot \frac{1}{{r}^{2}}\right) - \frac{3}{2}} \]
    6. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto \frac{-3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)} \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{-3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right), \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)}\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left({r}^{2} \cdot {w}^{2}\right) \cdot \frac{-3}{8}\right), \left(\color{blue}{2 \cdot \frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
      4. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(\left({r}^{2} \cdot \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2 \cdot \frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left({r}^{2}\right), \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2 \cdot \frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(r \cdot r\right), \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2} \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2} \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\left({w}^{2}\right), \frac{-3}{8}\right)\right), \left(2 \cdot \color{blue}{\frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\left(w \cdot w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{\color{blue}{1}}{{r}^{2}} - \frac{3}{2}\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{\color{blue}{1}}{{r}^{2}} - \frac{3}{2}\right)\right) \]
      11. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{1}{{r}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2}\right)\right)}\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{1}{{r}^{2}} + \frac{-3}{2}\right)\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\left(2 \cdot \frac{1}{{r}^{2}}\right), \color{blue}{\frac{-3}{2}}\right)\right) \]
      14. associate-*r/N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\left(\frac{2 \cdot 1}{{r}^{2}}\right), \frac{-3}{2}\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\left(\frac{2}{{r}^{2}}\right), \frac{-3}{2}\right)\right) \]
      16. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left({r}^{2}\right)\right), \frac{-3}{2}\right)\right) \]
      17. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left(r \cdot r\right)\right), \frac{-3}{2}\right)\right) \]
      18. *-lowering-*.f6491.0%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
    7. Simplified91.0%

      \[\leadsto \color{blue}{\left(r \cdot r\right) \cdot \left(\left(w \cdot w\right) \cdot -0.375\right) + \left(\frac{2}{r \cdot r} + -1.5\right)} \]
    8. Taylor expanded in r around inf

      \[\leadsto \color{blue}{{r}^{2} \cdot \left(\frac{-3}{8} \cdot {w}^{2} - \frac{3}{2} \cdot \frac{1}{{r}^{2}}\right)} \]
    9. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left({r}^{2}\right), \color{blue}{\left(\frac{-3}{8} \cdot {w}^{2} - \frac{3}{2} \cdot \frac{1}{{r}^{2}}\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\left(r \cdot r\right), \left(\color{blue}{\frac{-3}{8} \cdot {w}^{2}} - \frac{3}{2} \cdot \frac{1}{{r}^{2}}\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \left(\color{blue}{\frac{-3}{8} \cdot {w}^{2}} - \frac{3}{2} \cdot \frac{1}{{r}^{2}}\right)\right) \]
      4. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \left(\frac{-3}{8} \cdot {w}^{2} + \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2} \cdot \frac{1}{{r}^{2}}\right)\right)}\right)\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\left(\frac{-3}{8} \cdot {w}^{2}\right), \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2} \cdot \frac{1}{{r}^{2}}\right)\right)}\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \left({w}^{2}\right)\right), \left(\mathsf{neg}\left(\color{blue}{\frac{3}{2} \cdot \frac{1}{{r}^{2}}}\right)\right)\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \left(w \cdot w\right)\right), \left(\mathsf{neg}\left(\frac{3}{2} \cdot \color{blue}{\frac{1}{{r}^{2}}}\right)\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \mathsf{*.f64}\left(w, w\right)\right), \left(\mathsf{neg}\left(\frac{3}{2} \cdot \color{blue}{\frac{1}{{r}^{2}}}\right)\right)\right)\right) \]
      9. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \mathsf{*.f64}\left(w, w\right)\right), \left(\mathsf{neg}\left(\frac{\frac{3}{2} \cdot 1}{{r}^{2}}\right)\right)\right)\right) \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \mathsf{*.f64}\left(w, w\right)\right), \left(\mathsf{neg}\left(\frac{\frac{3}{2}}{{r}^{2}}\right)\right)\right)\right) \]
      11. distribute-neg-fracN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \mathsf{*.f64}\left(w, w\right)\right), \left(\frac{\mathsf{neg}\left(\frac{3}{2}\right)}{\color{blue}{{r}^{2}}}\right)\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \mathsf{*.f64}\left(w, w\right)\right), \left(\frac{\frac{-3}{2}}{{\color{blue}{r}}^{2}}\right)\right)\right) \]
      13. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \mathsf{*.f64}\left(w, w\right)\right), \mathsf{/.f64}\left(\frac{-3}{2}, \color{blue}{\left({r}^{2}\right)}\right)\right)\right) \]
      14. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \mathsf{*.f64}\left(w, w\right)\right), \mathsf{/.f64}\left(\frac{-3}{2}, \left(r \cdot \color{blue}{r}\right)\right)\right)\right) \]
      15. *-lowering-*.f6491.0%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \mathsf{*.f64}\left(w, w\right)\right), \mathsf{/.f64}\left(\frac{-3}{2}, \mathsf{*.f64}\left(r, \color{blue}{r}\right)\right)\right)\right) \]
    10. Simplified91.0%

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

    if 7.39999999999999992e152 < r

    1. Initial program 90.4%

      \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
    2. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) + \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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)\right) - \frac{9}{2} \]
      2. +-commutativeN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \left(3 + \frac{2}{r \cdot r}\right)\right) - \frac{9}{2} \]
      3. associate--l+N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)} \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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), \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)}\right) \]
    3. Simplified93.2%

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

      \[\leadsto \color{blue}{\frac{{r}^{2} \cdot \left({w}^{2} \cdot \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right)}{v - 1}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left({r}^{2} \cdot \left({w}^{2} \cdot \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right)\right), \color{blue}{\left(v - 1\right)}\right) \]
      2. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\left({r}^{2} \cdot {w}^{2}\right) \cdot \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(\color{blue}{v} - 1\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left({r}^{2} \cdot {w}^{2}\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(\color{blue}{v} - 1\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\left(r \cdot r\right) \cdot {w}^{2}\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      5. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(r \cdot \left(r \cdot {w}^{2}\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \left(r \cdot {w}^{2}\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \left({w}^{2}\right)\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      8. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \left(w \cdot w\right)\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \left(\frac{-1}{4} \cdot v\right)\right)\right), \left(v - 1\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \left(v \cdot \frac{-1}{4}\right)\right)\right), \left(v - 1\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \left(v - 1\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \left(v + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right) \]
      14. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \left(v + -1\right)\right) \]
      15. +-lowering-+.f6477.6%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \mathsf{+.f64}\left(v, \color{blue}{-1}\right)\right) \]
    7. Simplified77.6%

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

      \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left({r}^{2} \cdot {w}^{2}\right)} \]
    9. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left({r}^{2} \cdot {w}^{2}\right) \cdot \color{blue}{\frac{-1}{4}} \]
      2. associate-*l*N/A

        \[\leadsto {r}^{2} \cdot \color{blue}{\left({w}^{2} \cdot \frac{-1}{4}\right)} \]
      3. unpow2N/A

        \[\leadsto \left(r \cdot r\right) \cdot \left(\color{blue}{{w}^{2}} \cdot \frac{-1}{4}\right) \]
      4. associate-*l*N/A

        \[\leadsto r \cdot \color{blue}{\left(r \cdot \left({w}^{2} \cdot \frac{-1}{4}\right)\right)} \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(r, \color{blue}{\left(r \cdot \left({w}^{2} \cdot \frac{-1}{4}\right)\right)}\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \color{blue}{\left({w}^{2} \cdot \frac{-1}{4}\right)}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(\left({w}^{2}\right), \color{blue}{\frac{-1}{4}}\right)\right)\right) \]
      8. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(\left(w \cdot w\right), \frac{-1}{4}\right)\right)\right) \]
      9. *-lowering-*.f6477.8%

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-1}{4}\right)\right)\right) \]
    10. Simplified77.8%

      \[\leadsto \color{blue}{r \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot -0.25\right)\right)} \]
    11. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto r \cdot \left(\left(\left(w \cdot w\right) \cdot \frac{-1}{4}\right) \cdot \color{blue}{r}\right) \]
      2. associate-*l*N/A

        \[\leadsto r \cdot \left(\left(w \cdot \left(w \cdot \frac{-1}{4}\right)\right) \cdot r\right) \]
      3. associate-*l*N/A

        \[\leadsto r \cdot \left(w \cdot \color{blue}{\left(\left(w \cdot \frac{-1}{4}\right) \cdot r\right)}\right) \]
      4. associate-*r*N/A

        \[\leadsto \left(r \cdot w\right) \cdot \color{blue}{\left(\left(w \cdot \frac{-1}{4}\right) \cdot r\right)} \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(r \cdot w\right), \color{blue}{\left(\left(w \cdot \frac{-1}{4}\right) \cdot r\right)}\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\left(w \cdot r\right), \left(\color{blue}{\left(w \cdot \frac{-1}{4}\right)} \cdot r\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, r\right), \left(\color{blue}{\left(w \cdot \frac{-1}{4}\right)} \cdot r\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, r\right), \left(r \cdot \color{blue}{\left(w \cdot \frac{-1}{4}\right)}\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, r\right), \mathsf{*.f64}\left(r, \color{blue}{\left(w \cdot \frac{-1}{4}\right)}\right)\right) \]
      10. *-lowering-*.f6482.2%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, r\right), \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, \color{blue}{\frac{-1}{4}}\right)\right)\right) \]
    12. Applied egg-rr82.2%

      \[\leadsto \color{blue}{\left(w \cdot r\right) \cdot \left(r \cdot \left(w \cdot -0.25\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification69.7%

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

Alternative 6: 98.3% accurate, 1.2× speedup?

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

\\
\left(0.375 + v \cdot -0.25\right) \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot \frac{w}{v + -1}\right)\right) + \left(\frac{2}{r \cdot r} + -1.5\right)
\end{array}
Derivation
  1. Initial program 86.0%

    \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
  2. Step-by-step derivation
    1. sub-negN/A

      \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) + \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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)\right) - \frac{9}{2} \]
    2. +-commutativeN/A

      \[\leadsto \left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \left(3 + \frac{2}{r \cdot r}\right)\right) - \frac{9}{2} \]
    3. associate--l+N/A

      \[\leadsto \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)} \]
    4. +-lowering-+.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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), \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)}\right) \]
  3. Simplified88.5%

    \[\leadsto \color{blue}{\left(0.375 + v \cdot -0.25\right) \cdot \frac{r \cdot \left(r \cdot \left(w \cdot w\right)\right)}{v + -1} + \left(\frac{2}{r \cdot r} + -1.5\right)} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. associate-/l*N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \left(r \cdot \frac{r \cdot \left(w \cdot w\right)}{v + -1}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \color{blue}{\mathsf{*.f64}\left(r, r\right)}\right), \frac{-3}{2}\right)\right) \]
    2. *-commutativeN/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \left(\frac{r \cdot \left(w \cdot w\right)}{v + -1} \cdot r\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \color{blue}{\mathsf{*.f64}\left(r, r\right)}\right), \frac{-3}{2}\right)\right) \]
    3. associate-*r*N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \left(\frac{\left(r \cdot w\right) \cdot w}{v + -1} \cdot r\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
    4. associate-/l*N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \left(\left(\left(r \cdot w\right) \cdot \frac{w}{v + -1}\right) \cdot r\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(\color{blue}{r}, r\right)\right), \frac{-3}{2}\right)\right) \]
    5. associate-*l*N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \left(\left(r \cdot w\right) \cdot \left(\frac{w}{v + -1} \cdot r\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \color{blue}{\mathsf{*.f64}\left(r, r\right)}\right), \frac{-3}{2}\right)\right) \]
    6. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \mathsf{*.f64}\left(\left(r \cdot w\right), \left(\frac{w}{v + -1} \cdot r\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \color{blue}{\mathsf{*.f64}\left(r, r\right)}\right), \frac{-3}{2}\right)\right) \]
    7. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \left(\frac{w}{v + -1} \cdot r\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(\color{blue}{r}, r\right)\right), \frac{-3}{2}\right)\right) \]
    8. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(\left(\frac{w}{v + -1}\right), r\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, \color{blue}{r}\right)\right), \frac{-3}{2}\right)\right) \]
    9. /-lowering-/.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(w, \left(v + -1\right)\right), r\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
    10. +-lowering-+.f6499.1%

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(w, \mathsf{+.f64}\left(v, -1\right)\right), r\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
  6. Applied egg-rr99.1%

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

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

Alternative 7: 92.5% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;r \leq 1.25 \cdot 10^{+222}:\\
\;\;\;\;\left(\frac{2}{r \cdot r} + -1.5\right) + w \cdot \left(-0.375 \cdot \left(r \cdot \left(r \cdot w\right)\right)\right)\\

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


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

    1. Initial program 85.8%

      \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
    2. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) + \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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)\right) - \frac{9}{2} \]
      2. +-commutativeN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \left(3 + \frac{2}{r \cdot r}\right)\right) - \frac{9}{2} \]
      3. associate--l+N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)} \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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), \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)}\right) \]
    3. Simplified88.1%

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

      \[\leadsto \color{blue}{\left(\frac{-3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right) + 2 \cdot \frac{1}{{r}^{2}}\right) - \frac{3}{2}} \]
    6. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto \frac{-3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)} \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{-3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right), \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)}\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left({r}^{2} \cdot {w}^{2}\right) \cdot \frac{-3}{8}\right), \left(\color{blue}{2 \cdot \frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
      4. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(\left({r}^{2} \cdot \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2 \cdot \frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left({r}^{2}\right), \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2 \cdot \frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(r \cdot r\right), \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2} \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2} \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\left({w}^{2}\right), \frac{-3}{8}\right)\right), \left(2 \cdot \color{blue}{\frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\left(w \cdot w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{\color{blue}{1}}{{r}^{2}} - \frac{3}{2}\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{\color{blue}{1}}{{r}^{2}} - \frac{3}{2}\right)\right) \]
      11. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{1}{{r}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2}\right)\right)}\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{1}{{r}^{2}} + \frac{-3}{2}\right)\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\left(2 \cdot \frac{1}{{r}^{2}}\right), \color{blue}{\frac{-3}{2}}\right)\right) \]
      14. associate-*r/N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\left(\frac{2 \cdot 1}{{r}^{2}}\right), \frac{-3}{2}\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\left(\frac{2}{{r}^{2}}\right), \frac{-3}{2}\right)\right) \]
      16. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left({r}^{2}\right)\right), \frac{-3}{2}\right)\right) \]
      17. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left(r \cdot r\right)\right), \frac{-3}{2}\right)\right) \]
      18. *-lowering-*.f6480.1%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
    7. Simplified80.1%

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

        \[\leadsto \mathsf{+.f64}\left(\left(\left(r \cdot r\right) \cdot \left(w \cdot \left(w \cdot \frac{-3}{8}\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \color{blue}{\mathsf{*.f64}\left(r, r\right)}\right), \frac{-3}{2}\right)\right) \]
      2. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(\left(r \cdot r\right) \cdot w\right) \cdot \left(w \cdot \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right)}, \frac{-3}{2}\right)\right) \]
      3. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(r \cdot \left(r \cdot w\right)\right) \cdot \left(w \cdot \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(\color{blue}{2}, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(r \cdot \left(r \cdot w\right)\right) \cdot \left(\frac{-3}{8} \cdot w\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \color{blue}{\mathsf{*.f64}\left(r, r\right)}\right), \frac{-3}{2}\right)\right) \]
      5. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(\left(r \cdot \left(r \cdot w\right)\right) \cdot \frac{-3}{8}\right) \cdot w\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right)}, \frac{-3}{2}\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(\left(r \cdot \left(r \cdot w\right)\right) \cdot \frac{-3}{8}\right), w\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right)}, \frac{-3}{2}\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(\frac{-3}{8} \cdot \left(r \cdot \left(r \cdot w\right)\right)\right), w\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(\color{blue}{2}, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \left(r \cdot \left(r \cdot w\right)\right)\right), w\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(\color{blue}{2}, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \mathsf{*.f64}\left(r, \left(r \cdot w\right)\right)\right), w\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
      10. *-lowering-*.f6493.3%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{-3}{8}, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, w\right)\right)\right), w\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
    9. Applied egg-rr93.3%

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

    if 1.25000000000000006e222 < r

    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. sub-negN/A

        \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) + \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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)\right) - \frac{9}{2} \]
      2. +-commutativeN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \left(3 + \frac{2}{r \cdot r}\right)\right) - \frac{9}{2} \]
      3. associate--l+N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)} \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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), \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)}\right) \]
    3. Simplified92.7%

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

      \[\leadsto \color{blue}{\frac{{r}^{2} \cdot \left({w}^{2} \cdot \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right)}{v - 1}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left({r}^{2} \cdot \left({w}^{2} \cdot \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right)\right), \color{blue}{\left(v - 1\right)}\right) \]
      2. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\left({r}^{2} \cdot {w}^{2}\right) \cdot \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(\color{blue}{v} - 1\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left({r}^{2} \cdot {w}^{2}\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(\color{blue}{v} - 1\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\left(r \cdot r\right) \cdot {w}^{2}\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      5. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(r \cdot \left(r \cdot {w}^{2}\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \left(r \cdot {w}^{2}\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \left({w}^{2}\right)\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      8. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \left(w \cdot w\right)\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \left(\frac{-1}{4} \cdot v\right)\right)\right), \left(v - 1\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \left(v \cdot \frac{-1}{4}\right)\right)\right), \left(v - 1\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \left(v - 1\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \left(v + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right) \]
      14. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \left(v + -1\right)\right) \]
      15. +-lowering-+.f6477.7%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \mathsf{+.f64}\left(v, \color{blue}{-1}\right)\right) \]
    7. Simplified77.7%

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

        \[\leadsto \left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right) \cdot \color{blue}{\frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1}} \]
      2. *-commutativeN/A

        \[\leadsto \frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1} \cdot \color{blue}{\left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right)} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1} \cdot \left(\left(r \cdot \left(w \cdot w\right)\right) \cdot \color{blue}{r}\right) \]
      4. associate-*r*N/A

        \[\leadsto \frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1} \cdot \left(\left(\left(r \cdot w\right) \cdot w\right) \cdot r\right) \]
      5. associate-*l*N/A

        \[\leadsto \frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1} \cdot \left(\left(r \cdot w\right) \cdot \color{blue}{\left(w \cdot r\right)}\right) \]
      6. *-commutativeN/A

        \[\leadsto \frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1} \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot \color{blue}{w}\right)\right) \]
      7. associate-*r*N/A

        \[\leadsto \left(\frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1} \cdot \left(r \cdot w\right)\right) \cdot \color{blue}{\left(r \cdot w\right)} \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1} \cdot \left(r \cdot w\right)\right), \color{blue}{\left(r \cdot w\right)}\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1}\right), \left(r \cdot w\right)\right), \left(\color{blue}{r} \cdot w\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{3}{8} + v \cdot \frac{-1}{4}\right), \left(v + -1\right)\right), \left(r \cdot w\right)\right), \left(r \cdot w\right)\right) \]
      11. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \left(v \cdot \frac{-1}{4}\right)\right), \left(v + -1\right)\right), \left(r \cdot w\right)\right), \left(r \cdot w\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \left(v + -1\right)\right), \left(r \cdot w\right)\right), \left(r \cdot w\right)\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \mathsf{+.f64}\left(v, -1\right)\right), \left(r \cdot w\right)\right), \left(r \cdot w\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \mathsf{+.f64}\left(v, -1\right)\right), \mathsf{*.f64}\left(r, w\right)\right), \left(r \cdot w\right)\right) \]
      15. *-lowering-*.f6489.9%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right), \mathsf{+.f64}\left(v, -1\right)\right), \mathsf{*.f64}\left(r, w\right)\right), \mathsf{*.f64}\left(r, \color{blue}{w}\right)\right) \]
    9. Applied egg-rr89.9%

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

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

Alternative 8: 93.5% accurate, 1.7× speedup?

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

\\
\left(\frac{2}{r \cdot r} + -1.5\right) + \left(r \cdot w\right) \cdot \left(w \cdot \left(r \cdot -0.375\right)\right)
\end{array}
Derivation
  1. Initial program 86.0%

    \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
  2. Step-by-step derivation
    1. sub-negN/A

      \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) + \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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)\right) - \frac{9}{2} \]
    2. +-commutativeN/A

      \[\leadsto \left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \left(3 + \frac{2}{r \cdot r}\right)\right) - \frac{9}{2} \]
    3. associate--l+N/A

      \[\leadsto \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)} \]
    4. +-lowering-+.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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), \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)}\right) \]
  3. Simplified88.5%

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

    \[\leadsto \color{blue}{\left(\frac{-3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right) + 2 \cdot \frac{1}{{r}^{2}}\right) - \frac{3}{2}} \]
  6. Step-by-step derivation
    1. associate--l+N/A

      \[\leadsto \frac{-3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)} \]
    2. +-lowering-+.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\left(\frac{-3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right), \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)}\right) \]
    3. *-commutativeN/A

      \[\leadsto \mathsf{+.f64}\left(\left(\left({r}^{2} \cdot {w}^{2}\right) \cdot \frac{-3}{8}\right), \left(\color{blue}{2 \cdot \frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
    4. associate-*l*N/A

      \[\leadsto \mathsf{+.f64}\left(\left({r}^{2} \cdot \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2 \cdot \frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
    5. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left({r}^{2}\right), \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2 \cdot \frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
    6. unpow2N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(r \cdot r\right), \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2} \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)\right) \]
    7. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2} \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)\right) \]
    8. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\left({w}^{2}\right), \frac{-3}{8}\right)\right), \left(2 \cdot \color{blue}{\frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
    9. unpow2N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\left(w \cdot w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{\color{blue}{1}}{{r}^{2}} - \frac{3}{2}\right)\right) \]
    10. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{\color{blue}{1}}{{r}^{2}} - \frac{3}{2}\right)\right) \]
    11. sub-negN/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{1}{{r}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2}\right)\right)}\right)\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{1}{{r}^{2}} + \frac{-3}{2}\right)\right) \]
    13. +-lowering-+.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\left(2 \cdot \frac{1}{{r}^{2}}\right), \color{blue}{\frac{-3}{2}}\right)\right) \]
    14. associate-*r/N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\left(\frac{2 \cdot 1}{{r}^{2}}\right), \frac{-3}{2}\right)\right) \]
    15. metadata-evalN/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\left(\frac{2}{{r}^{2}}\right), \frac{-3}{2}\right)\right) \]
    16. /-lowering-/.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left({r}^{2}\right)\right), \frac{-3}{2}\right)\right) \]
    17. unpow2N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left(r \cdot r\right)\right), \frac{-3}{2}\right)\right) \]
    18. *-lowering-*.f6479.3%

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
  7. Simplified79.3%

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

      \[\leadsto \mathsf{+.f64}\left(\left(\left(\left(r \cdot r\right) \cdot \left(w \cdot w\right)\right) \cdot \frac{-3}{8}\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right)}, \frac{-3}{2}\right)\right) \]
    2. associate-*r*N/A

      \[\leadsto \mathsf{+.f64}\left(\left(\left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right) \cdot \frac{-3}{8}\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(\color{blue}{2}, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
    3. *-commutativeN/A

      \[\leadsto \mathsf{+.f64}\left(\left(\left(\left(r \cdot \left(w \cdot w\right)\right) \cdot r\right) \cdot \frac{-3}{8}\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(\color{blue}{2}, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
    4. associate-*l*N/A

      \[\leadsto \mathsf{+.f64}\left(\left(\left(r \cdot \left(w \cdot w\right)\right) \cdot \left(r \cdot \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right)}, \frac{-3}{2}\right)\right) \]
    5. associate-*r*N/A

      \[\leadsto \mathsf{+.f64}\left(\left(\left(\left(r \cdot w\right) \cdot w\right) \cdot \left(r \cdot \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(\color{blue}{2}, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
    6. associate-*l*N/A

      \[\leadsto \mathsf{+.f64}\left(\left(\left(r \cdot w\right) \cdot \left(w \cdot \left(r \cdot \frac{-3}{8}\right)\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right)}, \frac{-3}{2}\right)\right) \]
    7. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(r \cdot w\right), \left(w \cdot \left(r \cdot \frac{-3}{8}\right)\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right)}, \frac{-3}{2}\right)\right) \]
    8. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \left(w \cdot \left(r \cdot \frac{-3}{8}\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(\color{blue}{2}, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
    9. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(w, \left(r \cdot \frac{-3}{8}\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \color{blue}{\mathsf{*.f64}\left(r, r\right)}\right), \frac{-3}{2}\right)\right) \]
    10. *-lowering-*.f6493.8%

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(w, \mathsf{*.f64}\left(r, \frac{-3}{8}\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, \color{blue}{r}\right)\right), \frac{-3}{2}\right)\right) \]
  9. Applied egg-rr93.8%

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

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

Alternative 9: 66.4% accurate, 2.1× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\left(r \cdot w\right) \cdot \left(r \cdot \left(-0.25 \cdot w\right)\right)\\


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

    1. Initial program 85.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. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) + \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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)\right) - \frac{9}{2} \]
      2. +-commutativeN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \left(3 + \frac{2}{r \cdot r}\right)\right) - \frac{9}{2} \]
      3. associate--l+N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)} \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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), \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)}\right) \]
    3. Simplified87.0%

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

      \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}} \]
    6. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto 2 \cdot \frac{1}{{r}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2}\right)\right)} \]
      2. metadata-evalN/A

        \[\leadsto 2 \cdot \frac{1}{{r}^{2}} + \frac{-3}{2} \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(2 \cdot \frac{1}{{r}^{2}}\right), \color{blue}{\frac{-3}{2}}\right) \]
      4. associate-*r/N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{2 \cdot 1}{{r}^{2}}\right), \frac{-3}{2}\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{2}{{r}^{2}}\right), \frac{-3}{2}\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left({r}^{2}\right)\right), \frac{-3}{2}\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left(r \cdot r\right)\right), \frac{-3}{2}\right) \]
      8. *-lowering-*.f6463.8%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right) \]
    7. Simplified63.8%

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

    if 7.0000000000000001e81 < r

    1. Initial program 89.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. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) + \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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)\right) - \frac{9}{2} \]
      2. +-commutativeN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \left(3 + \frac{2}{r \cdot r}\right)\right) - \frac{9}{2} \]
      3. associate--l+N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)} \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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), \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)}\right) \]
    3. Simplified95.2%

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

      \[\leadsto \color{blue}{\frac{{r}^{2} \cdot \left({w}^{2} \cdot \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right)}{v - 1}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left({r}^{2} \cdot \left({w}^{2} \cdot \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right)\right), \color{blue}{\left(v - 1\right)}\right) \]
      2. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\left({r}^{2} \cdot {w}^{2}\right) \cdot \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(\color{blue}{v} - 1\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left({r}^{2} \cdot {w}^{2}\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(\color{blue}{v} - 1\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\left(r \cdot r\right) \cdot {w}^{2}\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      5. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(r \cdot \left(r \cdot {w}^{2}\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \left(r \cdot {w}^{2}\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \left({w}^{2}\right)\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      8. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \left(w \cdot w\right)\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \left(\frac{-1}{4} \cdot v\right)\right)\right), \left(v - 1\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \left(v \cdot \frac{-1}{4}\right)\right)\right), \left(v - 1\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \left(v - 1\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \left(v + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right) \]
      14. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \left(v + -1\right)\right) \]
      15. +-lowering-+.f6476.2%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \mathsf{+.f64}\left(v, \color{blue}{-1}\right)\right) \]
    7. Simplified76.2%

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

      \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left({r}^{2} \cdot {w}^{2}\right)} \]
    9. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left({r}^{2} \cdot {w}^{2}\right) \cdot \color{blue}{\frac{-1}{4}} \]
      2. associate-*l*N/A

        \[\leadsto {r}^{2} \cdot \color{blue}{\left({w}^{2} \cdot \frac{-1}{4}\right)} \]
      3. unpow2N/A

        \[\leadsto \left(r \cdot r\right) \cdot \left(\color{blue}{{w}^{2}} \cdot \frac{-1}{4}\right) \]
      4. associate-*l*N/A

        \[\leadsto r \cdot \color{blue}{\left(r \cdot \left({w}^{2} \cdot \frac{-1}{4}\right)\right)} \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(r, \color{blue}{\left(r \cdot \left({w}^{2} \cdot \frac{-1}{4}\right)\right)}\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \color{blue}{\left({w}^{2} \cdot \frac{-1}{4}\right)}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(\left({w}^{2}\right), \color{blue}{\frac{-1}{4}}\right)\right)\right) \]
      8. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(\left(w \cdot w\right), \frac{-1}{4}\right)\right)\right) \]
      9. *-lowering-*.f6478.5%

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-1}{4}\right)\right)\right) \]
    10. Simplified78.5%

      \[\leadsto \color{blue}{r \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot -0.25\right)\right)} \]
    11. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto r \cdot \left(\left(\left(w \cdot w\right) \cdot \frac{-1}{4}\right) \cdot \color{blue}{r}\right) \]
      2. associate-*l*N/A

        \[\leadsto r \cdot \left(\left(w \cdot \left(w \cdot \frac{-1}{4}\right)\right) \cdot r\right) \]
      3. associate-*l*N/A

        \[\leadsto r \cdot \left(w \cdot \color{blue}{\left(\left(w \cdot \frac{-1}{4}\right) \cdot r\right)}\right) \]
      4. associate-*r*N/A

        \[\leadsto \left(r \cdot w\right) \cdot \color{blue}{\left(\left(w \cdot \frac{-1}{4}\right) \cdot r\right)} \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(r \cdot w\right), \color{blue}{\left(\left(w \cdot \frac{-1}{4}\right) \cdot r\right)}\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\left(w \cdot r\right), \left(\color{blue}{\left(w \cdot \frac{-1}{4}\right)} \cdot r\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, r\right), \left(\color{blue}{\left(w \cdot \frac{-1}{4}\right)} \cdot r\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, r\right), \left(r \cdot \color{blue}{\left(w \cdot \frac{-1}{4}\right)}\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, r\right), \mathsf{*.f64}\left(r, \color{blue}{\left(w \cdot \frac{-1}{4}\right)}\right)\right) \]
      10. *-lowering-*.f6481.6%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, r\right), \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, \color{blue}{\frac{-1}{4}}\right)\right)\right) \]
    12. Applied egg-rr81.6%

      \[\leadsto \color{blue}{\left(w \cdot r\right) \cdot \left(r \cdot \left(w \cdot -0.25\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification67.0%

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

Alternative 10: 66.8% accurate, 2.1× speedup?

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

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

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


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

    1. Initial program 85.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. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) + \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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)\right) - \frac{9}{2} \]
      2. +-commutativeN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \left(3 + \frac{2}{r \cdot r}\right)\right) - \frac{9}{2} \]
      3. associate--l+N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)} \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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), \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)}\right) \]
    3. Simplified87.0%

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

      \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}} \]
    6. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto 2 \cdot \frac{1}{{r}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2}\right)\right)} \]
      2. metadata-evalN/A

        \[\leadsto 2 \cdot \frac{1}{{r}^{2}} + \frac{-3}{2} \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(2 \cdot \frac{1}{{r}^{2}}\right), \color{blue}{\frac{-3}{2}}\right) \]
      4. associate-*r/N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{2 \cdot 1}{{r}^{2}}\right), \frac{-3}{2}\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{2}{{r}^{2}}\right), \frac{-3}{2}\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left({r}^{2}\right)\right), \frac{-3}{2}\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left(r \cdot r\right)\right), \frac{-3}{2}\right) \]
      8. *-lowering-*.f6463.8%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right) \]
    7. Simplified63.8%

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

    if 5.3999999999999999e81 < r

    1. Initial program 89.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. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) + \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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)\right) - \frac{9}{2} \]
      2. +-commutativeN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \left(3 + \frac{2}{r \cdot r}\right)\right) - \frac{9}{2} \]
      3. associate--l+N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)} \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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), \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)}\right) \]
    3. Simplified95.2%

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

      \[\leadsto \color{blue}{\frac{{r}^{2} \cdot \left({w}^{2} \cdot \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right)}{v - 1}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left({r}^{2} \cdot \left({w}^{2} \cdot \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right)\right), \color{blue}{\left(v - 1\right)}\right) \]
      2. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\left({r}^{2} \cdot {w}^{2}\right) \cdot \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(\color{blue}{v} - 1\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left({r}^{2} \cdot {w}^{2}\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(\color{blue}{v} - 1\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\left(r \cdot r\right) \cdot {w}^{2}\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      5. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(r \cdot \left(r \cdot {w}^{2}\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \left(r \cdot {w}^{2}\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \left({w}^{2}\right)\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      8. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \left(w \cdot w\right)\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \left(\frac{-1}{4} \cdot v\right)\right)\right), \left(v - 1\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \left(v \cdot \frac{-1}{4}\right)\right)\right), \left(v - 1\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \left(v - 1\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \left(v + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right) \]
      14. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \left(v + -1\right)\right) \]
      15. +-lowering-+.f6476.2%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \mathsf{+.f64}\left(v, \color{blue}{-1}\right)\right) \]
    7. Simplified76.2%

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

        \[\leadsto \left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right) \cdot \color{blue}{\frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1}} \]
      2. *-commutativeN/A

        \[\leadsto \left(\left(r \cdot \left(w \cdot w\right)\right) \cdot r\right) \cdot \frac{\color{blue}{\frac{3}{8} + v \cdot \frac{-1}{4}}}{v + -1} \]
      3. associate-*l*N/A

        \[\leadsto \left(r \cdot \left(w \cdot w\right)\right) \cdot \color{blue}{\left(r \cdot \frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1}\right)} \]
      4. associate-*r*N/A

        \[\leadsto \left(\left(r \cdot w\right) \cdot w\right) \cdot \left(\color{blue}{r} \cdot \frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1}\right) \]
      5. associate-*l*N/A

        \[\leadsto \left(r \cdot w\right) \cdot \color{blue}{\left(w \cdot \left(r \cdot \frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1}\right)\right)} \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(r \cdot w\right), \color{blue}{\left(w \cdot \left(r \cdot \frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1}\right)\right)}\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \left(\color{blue}{w} \cdot \left(r \cdot \frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1}\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(w, \color{blue}{\left(r \cdot \frac{\frac{3}{8} + v \cdot \frac{-1}{4}}{v + -1}\right)}\right)\right) \]
      9. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(w, \left(\frac{r \cdot \left(\frac{3}{8} + v \cdot \frac{-1}{4}\right)}{\color{blue}{v + -1}}\right)\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(w, \mathsf{/.f64}\left(\left(r \cdot \left(\frac{3}{8} + v \cdot \frac{-1}{4}\right)\right), \color{blue}{\left(v + -1\right)}\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(w, \mathsf{/.f64}\left(\mathsf{*.f64}\left(r, \left(\frac{3}{8} + v \cdot \frac{-1}{4}\right)\right), \left(\color{blue}{v} + -1\right)\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(w, \mathsf{/.f64}\left(\mathsf{*.f64}\left(r, \mathsf{+.f64}\left(\frac{3}{8}, \left(v \cdot \frac{-1}{4}\right)\right)\right), \left(v + -1\right)\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(w, \mathsf{/.f64}\left(\mathsf{*.f64}\left(r, \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \left(v + -1\right)\right)\right)\right) \]
      14. +-lowering-+.f6483.5%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(w, \mathsf{/.f64}\left(\mathsf{*.f64}\left(r, \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \mathsf{+.f64}\left(v, \color{blue}{-1}\right)\right)\right)\right) \]
    9. Applied egg-rr83.5%

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \color{blue}{\left(\frac{-3}{8} \cdot \left(r \cdot w\right)\right)}\right) \]
    11. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \left(\left(\frac{-3}{8} \cdot r\right) \cdot \color{blue}{w}\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \left(\left(r \cdot \frac{-3}{8}\right) \cdot w\right)\right) \]
      3. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \left(r \cdot \color{blue}{\left(\frac{-3}{8} \cdot w\right)}\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(r, \color{blue}{\left(\frac{-3}{8} \cdot w\right)}\right)\right) \]
      5. *-lowering-*.f6473.5%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(\frac{-3}{8}, \color{blue}{w}\right)\right)\right) \]
    12. Simplified73.5%

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

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

Alternative 11: 65.7% accurate, 2.1× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;r \cdot \left(r \cdot \left(-0.25 \cdot \left(w \cdot w\right)\right)\right)\\


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

    1. Initial program 85.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. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) + \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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)\right) - \frac{9}{2} \]
      2. +-commutativeN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \left(3 + \frac{2}{r \cdot r}\right)\right) - \frac{9}{2} \]
      3. associate--l+N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)} \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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), \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)}\right) \]
    3. Simplified87.0%

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

      \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}} \]
    6. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto 2 \cdot \frac{1}{{r}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2}\right)\right)} \]
      2. metadata-evalN/A

        \[\leadsto 2 \cdot \frac{1}{{r}^{2}} + \frac{-3}{2} \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(2 \cdot \frac{1}{{r}^{2}}\right), \color{blue}{\frac{-3}{2}}\right) \]
      4. associate-*r/N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{2 \cdot 1}{{r}^{2}}\right), \frac{-3}{2}\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{2}{{r}^{2}}\right), \frac{-3}{2}\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left({r}^{2}\right)\right), \frac{-3}{2}\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left(r \cdot r\right)\right), \frac{-3}{2}\right) \]
      8. *-lowering-*.f6463.8%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right) \]
    7. Simplified63.8%

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

    if 8.20000000000000024e81 < r

    1. Initial program 89.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. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) + \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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)\right) - \frac{9}{2} \]
      2. +-commutativeN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \left(3 + \frac{2}{r \cdot r}\right)\right) - \frac{9}{2} \]
      3. associate--l+N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)} \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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), \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)}\right) \]
    3. Simplified95.2%

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

      \[\leadsto \color{blue}{\frac{{r}^{2} \cdot \left({w}^{2} \cdot \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right)}{v - 1}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left({r}^{2} \cdot \left({w}^{2} \cdot \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right)\right), \color{blue}{\left(v - 1\right)}\right) \]
      2. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\left({r}^{2} \cdot {w}^{2}\right) \cdot \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(\color{blue}{v} - 1\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left({r}^{2} \cdot {w}^{2}\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(\color{blue}{v} - 1\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\left(r \cdot r\right) \cdot {w}^{2}\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      5. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(r \cdot \left(r \cdot {w}^{2}\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \left(r \cdot {w}^{2}\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \left({w}^{2}\right)\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      8. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \left(w \cdot w\right)\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \left(\frac{3}{8} + \frac{-1}{4} \cdot v\right)\right), \left(v - 1\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \left(\frac{-1}{4} \cdot v\right)\right)\right), \left(v - 1\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \left(v \cdot \frac{-1}{4}\right)\right)\right), \left(v - 1\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \left(v - 1\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \left(v + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right) \]
      14. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \left(v + -1\right)\right) \]
      15. +-lowering-+.f6476.2%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(w, w\right)\right)\right), \mathsf{+.f64}\left(\frac{3}{8}, \mathsf{*.f64}\left(v, \frac{-1}{4}\right)\right)\right), \mathsf{+.f64}\left(v, \color{blue}{-1}\right)\right) \]
    7. Simplified76.2%

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

      \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left({r}^{2} \cdot {w}^{2}\right)} \]
    9. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left({r}^{2} \cdot {w}^{2}\right) \cdot \color{blue}{\frac{-1}{4}} \]
      2. associate-*l*N/A

        \[\leadsto {r}^{2} \cdot \color{blue}{\left({w}^{2} \cdot \frac{-1}{4}\right)} \]
      3. unpow2N/A

        \[\leadsto \left(r \cdot r\right) \cdot \left(\color{blue}{{w}^{2}} \cdot \frac{-1}{4}\right) \]
      4. associate-*l*N/A

        \[\leadsto r \cdot \color{blue}{\left(r \cdot \left({w}^{2} \cdot \frac{-1}{4}\right)\right)} \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(r, \color{blue}{\left(r \cdot \left({w}^{2} \cdot \frac{-1}{4}\right)\right)}\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \color{blue}{\left({w}^{2} \cdot \frac{-1}{4}\right)}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(\left({w}^{2}\right), \color{blue}{\frac{-1}{4}}\right)\right)\right) \]
      8. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(\left(w \cdot w\right), \frac{-1}{4}\right)\right)\right) \]
      9. *-lowering-*.f6478.5%

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-1}{4}\right)\right)\right) \]
    10. Simplified78.5%

      \[\leadsto \color{blue}{r \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot -0.25\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification66.4%

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

Alternative 12: 65.8% accurate, 2.1× speedup?

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

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

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


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

    1. Initial program 85.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. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) + \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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)\right) - \frac{9}{2} \]
      2. +-commutativeN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \left(3 + \frac{2}{r \cdot r}\right)\right) - \frac{9}{2} \]
      3. associate--l+N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)} \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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), \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)}\right) \]
    3. Simplified87.0%

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

      \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}} \]
    6. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto 2 \cdot \frac{1}{{r}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2}\right)\right)} \]
      2. metadata-evalN/A

        \[\leadsto 2 \cdot \frac{1}{{r}^{2}} + \frac{-3}{2} \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(2 \cdot \frac{1}{{r}^{2}}\right), \color{blue}{\frac{-3}{2}}\right) \]
      4. associate-*r/N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{2 \cdot 1}{{r}^{2}}\right), \frac{-3}{2}\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{2}{{r}^{2}}\right), \frac{-3}{2}\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left({r}^{2}\right)\right), \frac{-3}{2}\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left(r \cdot r\right)\right), \frac{-3}{2}\right) \]
      8. *-lowering-*.f6463.8%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right) \]
    7. Simplified63.8%

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

    if 5.5000000000000003e81 < r

    1. Initial program 89.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. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) + \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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)\right) - \frac{9}{2} \]
      2. +-commutativeN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \left(3 + \frac{2}{r \cdot r}\right)\right) - \frac{9}{2} \]
      3. associate--l+N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)} \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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), \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)}\right) \]
    3. Simplified95.2%

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

      \[\leadsto \color{blue}{\left(\frac{-3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right) + 2 \cdot \frac{1}{{r}^{2}}\right) - \frac{3}{2}} \]
    6. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto \frac{-3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)} \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{-3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right), \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)}\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left({r}^{2} \cdot {w}^{2}\right) \cdot \frac{-3}{8}\right), \left(\color{blue}{2 \cdot \frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
      4. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(\left({r}^{2} \cdot \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2 \cdot \frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left({r}^{2}\right), \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2 \cdot \frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(r \cdot r\right), \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2} \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \left({w}^{2} \cdot \frac{-3}{8}\right)\right), \left(\color{blue}{2} \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\left({w}^{2}\right), \frac{-3}{8}\right)\right), \left(2 \cdot \color{blue}{\frac{1}{{r}^{2}}} - \frac{3}{2}\right)\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\left(w \cdot w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{\color{blue}{1}}{{r}^{2}} - \frac{3}{2}\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{\color{blue}{1}}{{r}^{2}} - \frac{3}{2}\right)\right) \]
      11. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{1}{{r}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2}\right)\right)}\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \left(2 \cdot \frac{1}{{r}^{2}} + \frac{-3}{2}\right)\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\left(2 \cdot \frac{1}{{r}^{2}}\right), \color{blue}{\frac{-3}{2}}\right)\right) \]
      14. associate-*r/N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\left(\frac{2 \cdot 1}{{r}^{2}}\right), \frac{-3}{2}\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\left(\frac{2}{{r}^{2}}\right), \frac{-3}{2}\right)\right) \]
      16. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left({r}^{2}\right)\right), \frac{-3}{2}\right)\right) \]
      17. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left(r \cdot r\right)\right), \frac{-3}{2}\right)\right) \]
      18. *-lowering-*.f6473.3%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, r\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(w, w\right), \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
    7. Simplified73.3%

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

        \[\leadsto \mathsf{+.f64}\left(\left(\left(\left(r \cdot r\right) \cdot \left(w \cdot w\right)\right) \cdot \frac{-3}{8}\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right)}, \frac{-3}{2}\right)\right) \]
      2. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right) \cdot \frac{-3}{8}\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(\color{blue}{2}, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(\left(r \cdot \left(w \cdot w\right)\right) \cdot r\right) \cdot \frac{-3}{8}\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(\color{blue}{2}, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
      4. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(r \cdot \left(w \cdot w\right)\right) \cdot \left(r \cdot \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right)}, \frac{-3}{2}\right)\right) \]
      5. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(\left(r \cdot w\right) \cdot w\right) \cdot \left(r \cdot \frac{-3}{8}\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(\color{blue}{2}, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(r \cdot w\right) \cdot \left(w \cdot \left(r \cdot \frac{-3}{8}\right)\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right)}, \frac{-3}{2}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(r \cdot w\right), \left(w \cdot \left(r \cdot \frac{-3}{8}\right)\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right)}, \frac{-3}{2}\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \left(w \cdot \left(r \cdot \frac{-3}{8}\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(\color{blue}{2}, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(w, \left(r \cdot \frac{-3}{8}\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \color{blue}{\mathsf{*.f64}\left(r, r\right)}\right), \frac{-3}{2}\right)\right) \]
      10. *-lowering-*.f6487.7%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(r, w\right), \mathsf{*.f64}\left(w, \mathsf{*.f64}\left(r, \frac{-3}{8}\right)\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, \color{blue}{r}\right)\right), \frac{-3}{2}\right)\right) \]
    9. Applied egg-rr87.7%

      \[\leadsto \color{blue}{\left(r \cdot w\right) \cdot \left(w \cdot \left(r \cdot -0.375\right)\right)} + \left(\frac{2}{r \cdot r} + -1.5\right) \]
    10. Taylor expanded in r around inf

      \[\leadsto \color{blue}{\frac{-3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)} \]
    11. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left({r}^{2} \cdot {w}^{2}\right) \cdot \color{blue}{\frac{-3}{8}} \]
      2. associate-*l*N/A

        \[\leadsto {r}^{2} \cdot \color{blue}{\left({w}^{2} \cdot \frac{-3}{8}\right)} \]
      3. *-commutativeN/A

        \[\leadsto {r}^{2} \cdot \left(\frac{-3}{8} \cdot \color{blue}{{w}^{2}}\right) \]
      4. unpow2N/A

        \[\leadsto \left(r \cdot r\right) \cdot \left(\color{blue}{\frac{-3}{8}} \cdot {w}^{2}\right) \]
      5. associate-*l*N/A

        \[\leadsto r \cdot \color{blue}{\left(r \cdot \left(\frac{-3}{8} \cdot {w}^{2}\right)\right)} \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(r, \color{blue}{\left(r \cdot \left(\frac{-3}{8} \cdot {w}^{2}\right)\right)}\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \color{blue}{\left(\frac{-3}{8} \cdot {w}^{2}\right)}\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(\frac{-3}{8}, \color{blue}{\left({w}^{2}\right)}\right)\right)\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(\frac{-3}{8}, \left(w \cdot \color{blue}{w}\right)\right)\right)\right) \]
      10. *-lowering-*.f6473.0%

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(r, \mathsf{*.f64}\left(\frac{-3}{8}, \mathsf{*.f64}\left(w, \color{blue}{w}\right)\right)\right)\right) \]
    12. Simplified73.0%

      \[\leadsto \color{blue}{r \cdot \left(r \cdot \left(-0.375 \cdot \left(w \cdot w\right)\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 13: 57.3% accurate, 4.1× speedup?

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

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

    \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
  2. Step-by-step derivation
    1. sub-negN/A

      \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) + \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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)\right) - \frac{9}{2} \]
    2. +-commutativeN/A

      \[\leadsto \left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \left(3 + \frac{2}{r \cdot r}\right)\right) - \frac{9}{2} \]
    3. associate--l+N/A

      \[\leadsto \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)} \]
    4. +-lowering-+.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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), \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)}\right) \]
  3. Simplified88.5%

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

    \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}} \]
  6. Step-by-step derivation
    1. sub-negN/A

      \[\leadsto 2 \cdot \frac{1}{{r}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2}\right)\right)} \]
    2. metadata-evalN/A

      \[\leadsto 2 \cdot \frac{1}{{r}^{2}} + \frac{-3}{2} \]
    3. +-lowering-+.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\left(2 \cdot \frac{1}{{r}^{2}}\right), \color{blue}{\frac{-3}{2}}\right) \]
    4. associate-*r/N/A

      \[\leadsto \mathsf{+.f64}\left(\left(\frac{2 \cdot 1}{{r}^{2}}\right), \frac{-3}{2}\right) \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{+.f64}\left(\left(\frac{2}{{r}^{2}}\right), \frac{-3}{2}\right) \]
    6. /-lowering-/.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left({r}^{2}\right)\right), \frac{-3}{2}\right) \]
    7. unpow2N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \left(r \cdot r\right)\right), \frac{-3}{2}\right) \]
    8. *-lowering-*.f6455.2%

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, r\right)\right), \frac{-3}{2}\right) \]
  7. Simplified55.2%

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

Alternative 14: 44.1% accurate, 5.8× speedup?

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

\\
\frac{2}{r \cdot r}
\end{array}
Derivation
  1. Initial program 86.0%

    \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
  2. Step-by-step derivation
    1. sub-negN/A

      \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) + \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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)\right) - \frac{9}{2} \]
    2. +-commutativeN/A

      \[\leadsto \left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \left(3 + \frac{2}{r \cdot r}\right)\right) - \frac{9}{2} \]
    3. associate--l+N/A

      \[\leadsto \left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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) + \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)} \]
    4. +-lowering-+.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{8} \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), \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{9}{2}\right)}\right) \]
  3. Simplified88.5%

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

    \[\leadsto \color{blue}{\frac{2}{{r}^{2}}} \]
  6. Step-by-step derivation
    1. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(2, \color{blue}{\left({r}^{2}\right)}\right) \]
    2. unpow2N/A

      \[\leadsto \mathsf{/.f64}\left(2, \left(r \cdot \color{blue}{r}\right)\right) \]
    3. *-lowering-*.f6442.7%

      \[\leadsto \mathsf{/.f64}\left(2, \mathsf{*.f64}\left(r, \color{blue}{r}\right)\right) \]
  7. Simplified42.7%

    \[\leadsto \color{blue}{\frac{2}{r \cdot r}} \]
  8. Add Preprocessing

Reproduce

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