Rosa's DopplerBench

Percentage Accurate: 72.3% → 94.8%
Time: 9.0s
Alternatives: 8
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \end{array} \]
(FPCore (u v t1) :precision binary64 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))
double code(double u, double v, double t1) {
	return (-t1 * v) / ((t1 + u) * (t1 + u));
}
real(8) function code(u, v, t1)
    real(8), intent (in) :: u
    real(8), intent (in) :: v
    real(8), intent (in) :: t1
    code = (-t1 * v) / ((t1 + u) * (t1 + u))
end function
public static double code(double u, double v, double t1) {
	return (-t1 * v) / ((t1 + u) * (t1 + u));
}
def code(u, v, t1):
	return (-t1 * v) / ((t1 + u) * (t1 + u))
function code(u, v, t1)
	return Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u)))
end
function tmp = code(u, v, t1)
	tmp = (-t1 * v) / ((t1 + u) * (t1 + u));
end
code[u_, v_, t1_] := N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}
\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 8 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: 72.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \end{array} \]
(FPCore (u v t1) :precision binary64 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))
double code(double u, double v, double t1) {
	return (-t1 * v) / ((t1 + u) * (t1 + u));
}
real(8) function code(u, v, t1)
    real(8), intent (in) :: u
    real(8), intent (in) :: v
    real(8), intent (in) :: t1
    code = (-t1 * v) / ((t1 + u) * (t1 + u))
end function
public static double code(double u, double v, double t1) {
	return (-t1 * v) / ((t1 + u) * (t1 + u));
}
def code(u, v, t1):
	return (-t1 * v) / ((t1 + u) * (t1 + u))
function code(u, v, t1)
	return Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u)))
end
function tmp = code(u, v, t1)
	tmp = (-t1 * v) / ((t1 + u) * (t1 + u));
end
code[u_, v_, t1_] := N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}
\end{array}

Alternative 1: 94.8% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \frac{-v}{\mathsf{fma}\left(u, 2 + \frac{u}{t1}, t1\right)} \end{array} \]
(FPCore (u v t1) :precision binary64 (/ (- v) (fma u (+ 2.0 (/ u t1)) t1)))
double code(double u, double v, double t1) {
	return -v / fma(u, (2.0 + (u / t1)), t1);
}
function code(u, v, t1)
	return Float64(Float64(-v) / fma(u, Float64(2.0 + Float64(u / t1)), t1))
end
code[u_, v_, t1_] := N[((-v) / N[(u * N[(2.0 + N[(u / t1), $MachinePrecision]), $MachinePrecision] + t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{-v}{\mathsf{fma}\left(u, 2 + \frac{u}{t1}, t1\right)}
\end{array}
Derivation
  1. Initial program 76.7%

    \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in t1 around inf

    \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\color{blue}{{t1}^{2} \cdot \left(1 + \left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right)\right)}} \]
  4. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\color{blue}{{t1}^{2} \cdot \left(1 + \left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right)\right)}} \]
    2. unpow2N/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\color{blue}{\left(t1 \cdot t1\right)} \cdot \left(1 + \left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right)\right)} \]
    3. lower-*.f64N/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\color{blue}{\left(t1 \cdot t1\right)} \cdot \left(1 + \left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right)\right)} \]
    4. +-commutativeN/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \color{blue}{\left(\left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right) + 1\right)}} \]
    5. +-commutativeN/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\color{blue}{\left(\frac{{u}^{2}}{{t1}^{2}} + 2 \cdot \frac{u}{t1}\right)} + 1\right)} \]
    6. unpow2N/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\left(\frac{\color{blue}{u \cdot u}}{{t1}^{2}} + 2 \cdot \frac{u}{t1}\right) + 1\right)} \]
    7. unpow2N/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\left(\frac{u \cdot u}{\color{blue}{t1 \cdot t1}} + 2 \cdot \frac{u}{t1}\right) + 1\right)} \]
    8. times-fracN/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\left(\color{blue}{\frac{u}{t1} \cdot \frac{u}{t1}} + 2 \cdot \frac{u}{t1}\right) + 1\right)} \]
    9. distribute-rgt-outN/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\color{blue}{\frac{u}{t1} \cdot \left(\frac{u}{t1} + 2\right)} + 1\right)} \]
    10. lower-fma.f64N/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \color{blue}{\mathsf{fma}\left(\frac{u}{t1}, \frac{u}{t1} + 2, 1\right)}} \]
    11. lower-/.f64N/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \mathsf{fma}\left(\color{blue}{\frac{u}{t1}}, \frac{u}{t1} + 2, 1\right)} \]
    12. lower-+.f64N/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \mathsf{fma}\left(\frac{u}{t1}, \color{blue}{\frac{u}{t1} + 2}, 1\right)} \]
    13. lower-/.f6455.4

      \[\leadsto \frac{\left(-t1\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \mathsf{fma}\left(\frac{u}{t1}, \color{blue}{\frac{u}{t1}} + 2, 1\right)} \]
  5. Simplified55.4%

    \[\leadsto \frac{\left(-t1\right) \cdot v}{\color{blue}{\left(t1 \cdot t1\right) \cdot \mathsf{fma}\left(\frac{u}{t1}, \frac{u}{t1} + 2, 1\right)}} \]
  6. Taylor expanded in v around 0

    \[\leadsto \color{blue}{-1 \cdot \frac{v}{t1 \cdot \left(1 + \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}\right)}} \]
  7. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{v}{t1 \cdot \left(1 + \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}\right)}\right)} \]
    2. lower-neg.f64N/A

      \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{v}{t1 \cdot \left(1 + \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}\right)}\right)} \]
    3. lower-/.f64N/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\frac{v}{t1 \cdot \left(1 + \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}\right)}}\right) \]
    4. +-commutativeN/A

      \[\leadsto \mathsf{neg}\left(\frac{v}{t1 \cdot \color{blue}{\left(\frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1} + 1\right)}}\right) \]
    5. distribute-lft-inN/A

      \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{t1 \cdot \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1} + t1 \cdot 1}}\right) \]
    6. *-rgt-identityN/A

      \[\leadsto \mathsf{neg}\left(\frac{v}{t1 \cdot \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1} + \color{blue}{t1}}\right) \]
    7. lower-fma.f64N/A

      \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{\mathsf{fma}\left(t1, \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}, t1\right)}}\right) \]
    8. lower-/.f64N/A

      \[\leadsto \mathsf{neg}\left(\frac{v}{\mathsf{fma}\left(t1, \color{blue}{\frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}}, t1\right)}\right) \]
    9. lower-*.f64N/A

      \[\leadsto \mathsf{neg}\left(\frac{v}{\mathsf{fma}\left(t1, \frac{\color{blue}{u \cdot \left(2 + \frac{u}{t1}\right)}}{t1}, t1\right)}\right) \]
    10. lower-+.f64N/A

      \[\leadsto \mathsf{neg}\left(\frac{v}{\mathsf{fma}\left(t1, \frac{u \cdot \color{blue}{\left(2 + \frac{u}{t1}\right)}}{t1}, t1\right)}\right) \]
    11. lower-/.f6488.6

      \[\leadsto -\frac{v}{\mathsf{fma}\left(t1, \frac{u \cdot \left(2 + \color{blue}{\frac{u}{t1}}\right)}{t1}, t1\right)} \]
  8. Simplified88.6%

    \[\leadsto \color{blue}{-\frac{v}{\mathsf{fma}\left(t1, \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}, t1\right)}} \]
  9. Taylor expanded in u around 0

    \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{t1 + u \cdot \left(2 + \frac{u}{t1}\right)}}\right) \]
  10. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{u \cdot \left(2 + \frac{u}{t1}\right) + t1}}\right) \]
    2. lower-fma.f64N/A

      \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{\mathsf{fma}\left(u, 2 + \frac{u}{t1}, t1\right)}}\right) \]
    3. lower-+.f64N/A

      \[\leadsto \mathsf{neg}\left(\frac{v}{\mathsf{fma}\left(u, \color{blue}{2 + \frac{u}{t1}}, t1\right)}\right) \]
    4. lower-/.f6495.9

      \[\leadsto -\frac{v}{\mathsf{fma}\left(u, 2 + \color{blue}{\frac{u}{t1}}, t1\right)} \]
  11. Simplified95.9%

    \[\leadsto -\frac{v}{\color{blue}{\mathsf{fma}\left(u, 2 + \frac{u}{t1}, t1\right)}} \]
  12. Final simplification95.9%

    \[\leadsto \frac{-v}{\mathsf{fma}\left(u, 2 + \frac{u}{t1}, t1\right)} \]
  13. Add Preprocessing

Alternative 2: 86.1% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := -\frac{v}{\mathsf{fma}\left(u, 2, t1\right)}\\ \mathbf{if}\;t1 \leq -4 \cdot 10^{+138}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t1 \leq 7.8 \cdot 10^{+123}:\\ \;\;\;\;\frac{v \cdot \left(-t1\right)}{\left(u + t1\right) \cdot \left(u + t1\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (u v t1)
 :precision binary64
 (let* ((t_1 (- (/ v (fma u 2.0 t1)))))
   (if (<= t1 -4e+138)
     t_1
     (if (<= t1 7.8e+123) (/ (* v (- t1)) (* (+ u t1) (+ u t1))) t_1))))
double code(double u, double v, double t1) {
	double t_1 = -(v / fma(u, 2.0, t1));
	double tmp;
	if (t1 <= -4e+138) {
		tmp = t_1;
	} else if (t1 <= 7.8e+123) {
		tmp = (v * -t1) / ((u + t1) * (u + t1));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(u, v, t1)
	t_1 = Float64(-Float64(v / fma(u, 2.0, t1)))
	tmp = 0.0
	if (t1 <= -4e+138)
		tmp = t_1;
	elseif (t1 <= 7.8e+123)
		tmp = Float64(Float64(v * Float64(-t1)) / Float64(Float64(u + t1) * Float64(u + t1)));
	else
		tmp = t_1;
	end
	return tmp
end
code[u_, v_, t1_] := Block[{t$95$1 = (-N[(v / N[(u * 2.0 + t1), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[t1, -4e+138], t$95$1, If[LessEqual[t1, 7.8e+123], N[(N[(v * (-t1)), $MachinePrecision] / N[(N[(u + t1), $MachinePrecision] * N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := -\frac{v}{\mathsf{fma}\left(u, 2, t1\right)}\\
\mathbf{if}\;t1 \leq -4 \cdot 10^{+138}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t1 \leq 7.8 \cdot 10^{+123}:\\
\;\;\;\;\frac{v \cdot \left(-t1\right)}{\left(u + t1\right) \cdot \left(u + t1\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t1 < -4.0000000000000001e138 or 7.79999999999999986e123 < t1

    1. Initial program 53.4%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t1 around inf

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\color{blue}{{t1}^{2} \cdot \left(1 + \left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right)\right)}} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\color{blue}{{t1}^{2} \cdot \left(1 + \left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right)\right)}} \]
      2. unpow2N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\color{blue}{\left(t1 \cdot t1\right)} \cdot \left(1 + \left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right)\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\color{blue}{\left(t1 \cdot t1\right)} \cdot \left(1 + \left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right)\right)} \]
      4. +-commutativeN/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \color{blue}{\left(\left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right) + 1\right)}} \]
      5. +-commutativeN/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\color{blue}{\left(\frac{{u}^{2}}{{t1}^{2}} + 2 \cdot \frac{u}{t1}\right)} + 1\right)} \]
      6. unpow2N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\left(\frac{\color{blue}{u \cdot u}}{{t1}^{2}} + 2 \cdot \frac{u}{t1}\right) + 1\right)} \]
      7. unpow2N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\left(\frac{u \cdot u}{\color{blue}{t1 \cdot t1}} + 2 \cdot \frac{u}{t1}\right) + 1\right)} \]
      8. times-fracN/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\left(\color{blue}{\frac{u}{t1} \cdot \frac{u}{t1}} + 2 \cdot \frac{u}{t1}\right) + 1\right)} \]
      9. distribute-rgt-outN/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\color{blue}{\frac{u}{t1} \cdot \left(\frac{u}{t1} + 2\right)} + 1\right)} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \color{blue}{\mathsf{fma}\left(\frac{u}{t1}, \frac{u}{t1} + 2, 1\right)}} \]
      11. lower-/.f64N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \mathsf{fma}\left(\color{blue}{\frac{u}{t1}}, \frac{u}{t1} + 2, 1\right)} \]
      12. lower-+.f64N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \mathsf{fma}\left(\frac{u}{t1}, \color{blue}{\frac{u}{t1} + 2}, 1\right)} \]
      13. lower-/.f6453.4

        \[\leadsto \frac{\left(-t1\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \mathsf{fma}\left(\frac{u}{t1}, \color{blue}{\frac{u}{t1}} + 2, 1\right)} \]
    5. Simplified53.4%

      \[\leadsto \frac{\left(-t1\right) \cdot v}{\color{blue}{\left(t1 \cdot t1\right) \cdot \mathsf{fma}\left(\frac{u}{t1}, \frac{u}{t1} + 2, 1\right)}} \]
    6. Taylor expanded in v around 0

      \[\leadsto \color{blue}{-1 \cdot \frac{v}{t1 \cdot \left(1 + \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}\right)}} \]
    7. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{v}{t1 \cdot \left(1 + \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}\right)}\right)} \]
      2. lower-neg.f64N/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{v}{t1 \cdot \left(1 + \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}\right)}\right)} \]
      3. lower-/.f64N/A

        \[\leadsto \mathsf{neg}\left(\color{blue}{\frac{v}{t1 \cdot \left(1 + \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}\right)}}\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{t1 \cdot \color{blue}{\left(\frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1} + 1\right)}}\right) \]
      5. distribute-lft-inN/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{t1 \cdot \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1} + t1 \cdot 1}}\right) \]
      6. *-rgt-identityN/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{t1 \cdot \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1} + \color{blue}{t1}}\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{\mathsf{fma}\left(t1, \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}, t1\right)}}\right) \]
      8. lower-/.f64N/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{\mathsf{fma}\left(t1, \color{blue}{\frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}}, t1\right)}\right) \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{\mathsf{fma}\left(t1, \frac{\color{blue}{u \cdot \left(2 + \frac{u}{t1}\right)}}{t1}, t1\right)}\right) \]
      10. lower-+.f64N/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{\mathsf{fma}\left(t1, \frac{u \cdot \color{blue}{\left(2 + \frac{u}{t1}\right)}}{t1}, t1\right)}\right) \]
      11. lower-/.f6495.9

        \[\leadsto -\frac{v}{\mathsf{fma}\left(t1, \frac{u \cdot \left(2 + \color{blue}{\frac{u}{t1}}\right)}{t1}, t1\right)} \]
    8. Simplified95.9%

      \[\leadsto \color{blue}{-\frac{v}{\mathsf{fma}\left(t1, \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}, t1\right)}} \]
    9. Taylor expanded in u around 0

      \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{t1 + 2 \cdot u}}\right) \]
    10. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{2 \cdot u + t1}}\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{u \cdot 2} + t1}\right) \]
      3. lower-fma.f6492.0

        \[\leadsto -\frac{v}{\color{blue}{\mathsf{fma}\left(u, 2, t1\right)}} \]
    11. Simplified92.0%

      \[\leadsto -\frac{v}{\color{blue}{\mathsf{fma}\left(u, 2, t1\right)}} \]

    if -4.0000000000000001e138 < t1 < 7.79999999999999986e123

    1. Initial program 85.6%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Final simplification87.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t1 \leq -4 \cdot 10^{+138}:\\ \;\;\;\;-\frac{v}{\mathsf{fma}\left(u, 2, t1\right)}\\ \mathbf{elif}\;t1 \leq 7.8 \cdot 10^{+123}:\\ \;\;\;\;\frac{v \cdot \left(-t1\right)}{\left(u + t1\right) \cdot \left(u + t1\right)}\\ \mathbf{else}:\\ \;\;\;\;-\frac{v}{\mathsf{fma}\left(u, 2, t1\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 76.6% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := -\frac{v}{\mathsf{fma}\left(u, 2, t1\right)}\\ \mathbf{if}\;t1 \leq -5.8 \cdot 10^{-55}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t1 \leq 3.9 \cdot 10^{-109}:\\ \;\;\;\;\frac{v}{\frac{u \cdot \left(-u\right)}{t1}}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (u v t1)
 :precision binary64
 (let* ((t_1 (- (/ v (fma u 2.0 t1)))))
   (if (<= t1 -5.8e-55)
     t_1
     (if (<= t1 3.9e-109) (/ v (/ (* u (- u)) t1)) t_1))))
double code(double u, double v, double t1) {
	double t_1 = -(v / fma(u, 2.0, t1));
	double tmp;
	if (t1 <= -5.8e-55) {
		tmp = t_1;
	} else if (t1 <= 3.9e-109) {
		tmp = v / ((u * -u) / t1);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(u, v, t1)
	t_1 = Float64(-Float64(v / fma(u, 2.0, t1)))
	tmp = 0.0
	if (t1 <= -5.8e-55)
		tmp = t_1;
	elseif (t1 <= 3.9e-109)
		tmp = Float64(v / Float64(Float64(u * Float64(-u)) / t1));
	else
		tmp = t_1;
	end
	return tmp
end
code[u_, v_, t1_] := Block[{t$95$1 = (-N[(v / N[(u * 2.0 + t1), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[t1, -5.8e-55], t$95$1, If[LessEqual[t1, 3.9e-109], N[(v / N[(N[(u * (-u)), $MachinePrecision] / t1), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := -\frac{v}{\mathsf{fma}\left(u, 2, t1\right)}\\
\mathbf{if}\;t1 \leq -5.8 \cdot 10^{-55}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t1 \leq 3.9 \cdot 10^{-109}:\\
\;\;\;\;\frac{v}{\frac{u \cdot \left(-u\right)}{t1}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t1 < -5.8e-55 or 3.90000000000000023e-109 < t1

    1. Initial program 72.2%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t1 around inf

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\color{blue}{{t1}^{2} \cdot \left(1 + \left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right)\right)}} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\color{blue}{{t1}^{2} \cdot \left(1 + \left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right)\right)}} \]
      2. unpow2N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\color{blue}{\left(t1 \cdot t1\right)} \cdot \left(1 + \left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right)\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\color{blue}{\left(t1 \cdot t1\right)} \cdot \left(1 + \left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right)\right)} \]
      4. +-commutativeN/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \color{blue}{\left(\left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right) + 1\right)}} \]
      5. +-commutativeN/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\color{blue}{\left(\frac{{u}^{2}}{{t1}^{2}} + 2 \cdot \frac{u}{t1}\right)} + 1\right)} \]
      6. unpow2N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\left(\frac{\color{blue}{u \cdot u}}{{t1}^{2}} + 2 \cdot \frac{u}{t1}\right) + 1\right)} \]
      7. unpow2N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\left(\frac{u \cdot u}{\color{blue}{t1 \cdot t1}} + 2 \cdot \frac{u}{t1}\right) + 1\right)} \]
      8. times-fracN/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\left(\color{blue}{\frac{u}{t1} \cdot \frac{u}{t1}} + 2 \cdot \frac{u}{t1}\right) + 1\right)} \]
      9. distribute-rgt-outN/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\color{blue}{\frac{u}{t1} \cdot \left(\frac{u}{t1} + 2\right)} + 1\right)} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \color{blue}{\mathsf{fma}\left(\frac{u}{t1}, \frac{u}{t1} + 2, 1\right)}} \]
      11. lower-/.f64N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \mathsf{fma}\left(\color{blue}{\frac{u}{t1}}, \frac{u}{t1} + 2, 1\right)} \]
      12. lower-+.f64N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \mathsf{fma}\left(\frac{u}{t1}, \color{blue}{\frac{u}{t1} + 2}, 1\right)} \]
      13. lower-/.f6470.9

        \[\leadsto \frac{\left(-t1\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \mathsf{fma}\left(\frac{u}{t1}, \color{blue}{\frac{u}{t1}} + 2, 1\right)} \]
    5. Simplified70.9%

      \[\leadsto \frac{\left(-t1\right) \cdot v}{\color{blue}{\left(t1 \cdot t1\right) \cdot \mathsf{fma}\left(\frac{u}{t1}, \frac{u}{t1} + 2, 1\right)}} \]
    6. Taylor expanded in v around 0

      \[\leadsto \color{blue}{-1 \cdot \frac{v}{t1 \cdot \left(1 + \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}\right)}} \]
    7. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{v}{t1 \cdot \left(1 + \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}\right)}\right)} \]
      2. lower-neg.f64N/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{v}{t1 \cdot \left(1 + \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}\right)}\right)} \]
      3. lower-/.f64N/A

        \[\leadsto \mathsf{neg}\left(\color{blue}{\frac{v}{t1 \cdot \left(1 + \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}\right)}}\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{t1 \cdot \color{blue}{\left(\frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1} + 1\right)}}\right) \]
      5. distribute-lft-inN/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{t1 \cdot \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1} + t1 \cdot 1}}\right) \]
      6. *-rgt-identityN/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{t1 \cdot \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1} + \color{blue}{t1}}\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{\mathsf{fma}\left(t1, \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}, t1\right)}}\right) \]
      8. lower-/.f64N/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{\mathsf{fma}\left(t1, \color{blue}{\frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}}, t1\right)}\right) \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{\mathsf{fma}\left(t1, \frac{\color{blue}{u \cdot \left(2 + \frac{u}{t1}\right)}}{t1}, t1\right)}\right) \]
      10. lower-+.f64N/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{\mathsf{fma}\left(t1, \frac{u \cdot \color{blue}{\left(2 + \frac{u}{t1}\right)}}{t1}, t1\right)}\right) \]
      11. lower-/.f6494.5

        \[\leadsto -\frac{v}{\mathsf{fma}\left(t1, \frac{u \cdot \left(2 + \color{blue}{\frac{u}{t1}}\right)}{t1}, t1\right)} \]
    8. Simplified94.5%

      \[\leadsto \color{blue}{-\frac{v}{\mathsf{fma}\left(t1, \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}, t1\right)}} \]
    9. Taylor expanded in u around 0

      \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{t1 + 2 \cdot u}}\right) \]
    10. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{2 \cdot u + t1}}\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{u \cdot 2} + t1}\right) \]
      3. lower-fma.f6483.2

        \[\leadsto -\frac{v}{\color{blue}{\mathsf{fma}\left(u, 2, t1\right)}} \]
    11. Simplified83.2%

      \[\leadsto -\frac{v}{\color{blue}{\mathsf{fma}\left(u, 2, t1\right)}} \]

    if -5.8e-55 < t1 < 3.90000000000000023e-109

    1. Initial program 82.6%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t1 around inf

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\color{blue}{{t1}^{2} \cdot \left(1 + \left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right)\right)}} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\color{blue}{{t1}^{2} \cdot \left(1 + \left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right)\right)}} \]
      2. unpow2N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\color{blue}{\left(t1 \cdot t1\right)} \cdot \left(1 + \left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right)\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\color{blue}{\left(t1 \cdot t1\right)} \cdot \left(1 + \left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right)\right)} \]
      4. +-commutativeN/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \color{blue}{\left(\left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right) + 1\right)}} \]
      5. +-commutativeN/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\color{blue}{\left(\frac{{u}^{2}}{{t1}^{2}} + 2 \cdot \frac{u}{t1}\right)} + 1\right)} \]
      6. unpow2N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\left(\frac{\color{blue}{u \cdot u}}{{t1}^{2}} + 2 \cdot \frac{u}{t1}\right) + 1\right)} \]
      7. unpow2N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\left(\frac{u \cdot u}{\color{blue}{t1 \cdot t1}} + 2 \cdot \frac{u}{t1}\right) + 1\right)} \]
      8. times-fracN/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\left(\color{blue}{\frac{u}{t1} \cdot \frac{u}{t1}} + 2 \cdot \frac{u}{t1}\right) + 1\right)} \]
      9. distribute-rgt-outN/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\color{blue}{\frac{u}{t1} \cdot \left(\frac{u}{t1} + 2\right)} + 1\right)} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \color{blue}{\mathsf{fma}\left(\frac{u}{t1}, \frac{u}{t1} + 2, 1\right)}} \]
      11. lower-/.f64N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \mathsf{fma}\left(\color{blue}{\frac{u}{t1}}, \frac{u}{t1} + 2, 1\right)} \]
      12. lower-+.f64N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \mathsf{fma}\left(\frac{u}{t1}, \color{blue}{\frac{u}{t1} + 2}, 1\right)} \]
      13. lower-/.f6434.8

        \[\leadsto \frac{\left(-t1\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \mathsf{fma}\left(\frac{u}{t1}, \color{blue}{\frac{u}{t1}} + 2, 1\right)} \]
    5. Simplified34.8%

      \[\leadsto \frac{\left(-t1\right) \cdot v}{\color{blue}{\left(t1 \cdot t1\right) \cdot \mathsf{fma}\left(\frac{u}{t1}, \frac{u}{t1} + 2, 1\right)}} \]
    6. Taylor expanded in v around 0

      \[\leadsto \color{blue}{-1 \cdot \frac{v}{t1 \cdot \left(1 + \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}\right)}} \]
    7. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{v}{t1 \cdot \left(1 + \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}\right)}\right)} \]
      2. lower-neg.f64N/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{v}{t1 \cdot \left(1 + \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}\right)}\right)} \]
      3. lower-/.f64N/A

        \[\leadsto \mathsf{neg}\left(\color{blue}{\frac{v}{t1 \cdot \left(1 + \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}\right)}}\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{t1 \cdot \color{blue}{\left(\frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1} + 1\right)}}\right) \]
      5. distribute-lft-inN/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{t1 \cdot \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1} + t1 \cdot 1}}\right) \]
      6. *-rgt-identityN/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{t1 \cdot \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1} + \color{blue}{t1}}\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{\mathsf{fma}\left(t1, \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}, t1\right)}}\right) \]
      8. lower-/.f64N/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{\mathsf{fma}\left(t1, \color{blue}{\frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}}, t1\right)}\right) \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{\mathsf{fma}\left(t1, \frac{\color{blue}{u \cdot \left(2 + \frac{u}{t1}\right)}}{t1}, t1\right)}\right) \]
      10. lower-+.f64N/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{\mathsf{fma}\left(t1, \frac{u \cdot \color{blue}{\left(2 + \frac{u}{t1}\right)}}{t1}, t1\right)}\right) \]
      11. lower-/.f6480.7

        \[\leadsto -\frac{v}{\mathsf{fma}\left(t1, \frac{u \cdot \left(2 + \color{blue}{\frac{u}{t1}}\right)}{t1}, t1\right)} \]
    8. Simplified80.7%

      \[\leadsto \color{blue}{-\frac{v}{\mathsf{fma}\left(t1, \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}, t1\right)}} \]
    9. Taylor expanded in t1 around 0

      \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{\frac{{u}^{2}}{t1}}}\right) \]
    10. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{\frac{{u}^{2}}{t1}}}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{\frac{\color{blue}{u \cdot u}}{t1}}\right) \]
      3. lower-*.f6482.2

        \[\leadsto -\frac{v}{\frac{\color{blue}{u \cdot u}}{t1}} \]
    11. Simplified82.2%

      \[\leadsto -\frac{v}{\color{blue}{\frac{u \cdot u}{t1}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification82.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t1 \leq -5.8 \cdot 10^{-55}:\\ \;\;\;\;-\frac{v}{\mathsf{fma}\left(u, 2, t1\right)}\\ \mathbf{elif}\;t1 \leq 3.9 \cdot 10^{-109}:\\ \;\;\;\;\frac{v}{\frac{u \cdot \left(-u\right)}{t1}}\\ \mathbf{else}:\\ \;\;\;\;-\frac{v}{\mathsf{fma}\left(u, 2, t1\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 73.7% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := t1 \cdot \frac{v}{u \cdot \left(-u\right)}\\ \mathbf{if}\;u \leq -8 \cdot 10^{-8}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;u \leq 4.7 \cdot 10^{+45}:\\ \;\;\;\;-\frac{v}{t1}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (u v t1)
 :precision binary64
 (let* ((t_1 (* t1 (/ v (* u (- u))))))
   (if (<= u -8e-8) t_1 (if (<= u 4.7e+45) (- (/ v t1)) t_1))))
double code(double u, double v, double t1) {
	double t_1 = t1 * (v / (u * -u));
	double tmp;
	if (u <= -8e-8) {
		tmp = t_1;
	} else if (u <= 4.7e+45) {
		tmp = -(v / t1);
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(u, v, t1)
    real(8), intent (in) :: u
    real(8), intent (in) :: v
    real(8), intent (in) :: t1
    real(8) :: t_1
    real(8) :: tmp
    t_1 = t1 * (v / (u * -u))
    if (u <= (-8d-8)) then
        tmp = t_1
    else if (u <= 4.7d+45) then
        tmp = -(v / t1)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double u, double v, double t1) {
	double t_1 = t1 * (v / (u * -u));
	double tmp;
	if (u <= -8e-8) {
		tmp = t_1;
	} else if (u <= 4.7e+45) {
		tmp = -(v / t1);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(u, v, t1):
	t_1 = t1 * (v / (u * -u))
	tmp = 0
	if u <= -8e-8:
		tmp = t_1
	elif u <= 4.7e+45:
		tmp = -(v / t1)
	else:
		tmp = t_1
	return tmp
function code(u, v, t1)
	t_1 = Float64(t1 * Float64(v / Float64(u * Float64(-u))))
	tmp = 0.0
	if (u <= -8e-8)
		tmp = t_1;
	elseif (u <= 4.7e+45)
		tmp = Float64(-Float64(v / t1));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(u, v, t1)
	t_1 = t1 * (v / (u * -u));
	tmp = 0.0;
	if (u <= -8e-8)
		tmp = t_1;
	elseif (u <= 4.7e+45)
		tmp = -(v / t1);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[u_, v_, t1_] := Block[{t$95$1 = N[(t1 * N[(v / N[(u * (-u)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[u, -8e-8], t$95$1, If[LessEqual[u, 4.7e+45], (-N[(v / t1), $MachinePrecision]), t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := t1 \cdot \frac{v}{u \cdot \left(-u\right)}\\
\mathbf{if}\;u \leq -8 \cdot 10^{-8}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;u \leq 4.7 \cdot 10^{+45}:\\
\;\;\;\;-\frac{v}{t1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if u < -8.0000000000000002e-8 or 4.70000000000000002e45 < u

    1. Initial program 86.2%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t1 around 0

      \[\leadsto \color{blue}{-1 \cdot \frac{t1 \cdot v}{{u}^{2}}} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{t1 \cdot v}{{u}^{2}}\right)} \]
      2. associate-/l*N/A

        \[\leadsto \mathsf{neg}\left(\color{blue}{t1 \cdot \frac{v}{{u}^{2}}}\right) \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto \color{blue}{t1 \cdot \left(\mathsf{neg}\left(\frac{v}{{u}^{2}}\right)\right)} \]
      4. mul-1-negN/A

        \[\leadsto t1 \cdot \color{blue}{\left(-1 \cdot \frac{v}{{u}^{2}}\right)} \]
      5. lower-*.f64N/A

        \[\leadsto \color{blue}{t1 \cdot \left(-1 \cdot \frac{v}{{u}^{2}}\right)} \]
      6. mul-1-negN/A

        \[\leadsto t1 \cdot \color{blue}{\left(\mathsf{neg}\left(\frac{v}{{u}^{2}}\right)\right)} \]
      7. distribute-neg-frac2N/A

        \[\leadsto t1 \cdot \color{blue}{\frac{v}{\mathsf{neg}\left({u}^{2}\right)}} \]
      8. mul-1-negN/A

        \[\leadsto t1 \cdot \frac{v}{\color{blue}{-1 \cdot {u}^{2}}} \]
      9. lower-/.f64N/A

        \[\leadsto t1 \cdot \color{blue}{\frac{v}{-1 \cdot {u}^{2}}} \]
      10. mul-1-negN/A

        \[\leadsto t1 \cdot \frac{v}{\color{blue}{\mathsf{neg}\left({u}^{2}\right)}} \]
      11. unpow2N/A

        \[\leadsto t1 \cdot \frac{v}{\mathsf{neg}\left(\color{blue}{u \cdot u}\right)} \]
      12. distribute-rgt-neg-inN/A

        \[\leadsto t1 \cdot \frac{v}{\color{blue}{u \cdot \left(\mathsf{neg}\left(u\right)\right)}} \]
      13. lower-*.f64N/A

        \[\leadsto t1 \cdot \frac{v}{\color{blue}{u \cdot \left(\mathsf{neg}\left(u\right)\right)}} \]
      14. lower-neg.f6484.4

        \[\leadsto t1 \cdot \frac{v}{u \cdot \color{blue}{\left(-u\right)}} \]
    5. Simplified84.4%

      \[\leadsto \color{blue}{t1 \cdot \frac{v}{u \cdot \left(-u\right)}} \]

    if -8.0000000000000002e-8 < u < 4.70000000000000002e45

    1. Initial program 68.4%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t1 around inf

      \[\leadsto \color{blue}{-1 \cdot \frac{v}{t1}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{-1 \cdot v}{t1}} \]
      2. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{-1 \cdot v}{t1}} \]
      3. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(v\right)}}{t1} \]
      4. lower-neg.f6480.5

        \[\leadsto \frac{\color{blue}{-v}}{t1} \]
    5. Simplified80.5%

      \[\leadsto \color{blue}{\frac{-v}{t1}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification82.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;u \leq -8 \cdot 10^{-8}:\\ \;\;\;\;t1 \cdot \frac{v}{u \cdot \left(-u\right)}\\ \mathbf{elif}\;u \leq 4.7 \cdot 10^{+45}:\\ \;\;\;\;-\frac{v}{t1}\\ \mathbf{else}:\\ \;\;\;\;t1 \cdot \frac{v}{u \cdot \left(-u\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 93.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{-v}{\mathsf{fma}\left(u, \frac{u}{t1}, t1\right)} \end{array} \]
(FPCore (u v t1) :precision binary64 (/ (- v) (fma u (/ u t1) t1)))
double code(double u, double v, double t1) {
	return -v / fma(u, (u / t1), t1);
}
function code(u, v, t1)
	return Float64(Float64(-v) / fma(u, Float64(u / t1), t1))
end
code[u_, v_, t1_] := N[((-v) / N[(u * N[(u / t1), $MachinePrecision] + t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{-v}{\mathsf{fma}\left(u, \frac{u}{t1}, t1\right)}
\end{array}
Derivation
  1. Initial program 76.7%

    \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in t1 around inf

    \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\color{blue}{{t1}^{2} \cdot \left(1 + \left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right)\right)}} \]
  4. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\color{blue}{{t1}^{2} \cdot \left(1 + \left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right)\right)}} \]
    2. unpow2N/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\color{blue}{\left(t1 \cdot t1\right)} \cdot \left(1 + \left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right)\right)} \]
    3. lower-*.f64N/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\color{blue}{\left(t1 \cdot t1\right)} \cdot \left(1 + \left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right)\right)} \]
    4. +-commutativeN/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \color{blue}{\left(\left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right) + 1\right)}} \]
    5. +-commutativeN/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\color{blue}{\left(\frac{{u}^{2}}{{t1}^{2}} + 2 \cdot \frac{u}{t1}\right)} + 1\right)} \]
    6. unpow2N/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\left(\frac{\color{blue}{u \cdot u}}{{t1}^{2}} + 2 \cdot \frac{u}{t1}\right) + 1\right)} \]
    7. unpow2N/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\left(\frac{u \cdot u}{\color{blue}{t1 \cdot t1}} + 2 \cdot \frac{u}{t1}\right) + 1\right)} \]
    8. times-fracN/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\left(\color{blue}{\frac{u}{t1} \cdot \frac{u}{t1}} + 2 \cdot \frac{u}{t1}\right) + 1\right)} \]
    9. distribute-rgt-outN/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\color{blue}{\frac{u}{t1} \cdot \left(\frac{u}{t1} + 2\right)} + 1\right)} \]
    10. lower-fma.f64N/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \color{blue}{\mathsf{fma}\left(\frac{u}{t1}, \frac{u}{t1} + 2, 1\right)}} \]
    11. lower-/.f64N/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \mathsf{fma}\left(\color{blue}{\frac{u}{t1}}, \frac{u}{t1} + 2, 1\right)} \]
    12. lower-+.f64N/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \mathsf{fma}\left(\frac{u}{t1}, \color{blue}{\frac{u}{t1} + 2}, 1\right)} \]
    13. lower-/.f6455.4

      \[\leadsto \frac{\left(-t1\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \mathsf{fma}\left(\frac{u}{t1}, \color{blue}{\frac{u}{t1}} + 2, 1\right)} \]
  5. Simplified55.4%

    \[\leadsto \frac{\left(-t1\right) \cdot v}{\color{blue}{\left(t1 \cdot t1\right) \cdot \mathsf{fma}\left(\frac{u}{t1}, \frac{u}{t1} + 2, 1\right)}} \]
  6. Taylor expanded in v around 0

    \[\leadsto \color{blue}{-1 \cdot \frac{v}{t1 \cdot \left(1 + \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}\right)}} \]
  7. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{v}{t1 \cdot \left(1 + \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}\right)}\right)} \]
    2. lower-neg.f64N/A

      \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{v}{t1 \cdot \left(1 + \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}\right)}\right)} \]
    3. lower-/.f64N/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\frac{v}{t1 \cdot \left(1 + \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}\right)}}\right) \]
    4. +-commutativeN/A

      \[\leadsto \mathsf{neg}\left(\frac{v}{t1 \cdot \color{blue}{\left(\frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1} + 1\right)}}\right) \]
    5. distribute-lft-inN/A

      \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{t1 \cdot \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1} + t1 \cdot 1}}\right) \]
    6. *-rgt-identityN/A

      \[\leadsto \mathsf{neg}\left(\frac{v}{t1 \cdot \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1} + \color{blue}{t1}}\right) \]
    7. lower-fma.f64N/A

      \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{\mathsf{fma}\left(t1, \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}, t1\right)}}\right) \]
    8. lower-/.f64N/A

      \[\leadsto \mathsf{neg}\left(\frac{v}{\mathsf{fma}\left(t1, \color{blue}{\frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}}, t1\right)}\right) \]
    9. lower-*.f64N/A

      \[\leadsto \mathsf{neg}\left(\frac{v}{\mathsf{fma}\left(t1, \frac{\color{blue}{u \cdot \left(2 + \frac{u}{t1}\right)}}{t1}, t1\right)}\right) \]
    10. lower-+.f64N/A

      \[\leadsto \mathsf{neg}\left(\frac{v}{\mathsf{fma}\left(t1, \frac{u \cdot \color{blue}{\left(2 + \frac{u}{t1}\right)}}{t1}, t1\right)}\right) \]
    11. lower-/.f6488.6

      \[\leadsto -\frac{v}{\mathsf{fma}\left(t1, \frac{u \cdot \left(2 + \color{blue}{\frac{u}{t1}}\right)}{t1}, t1\right)} \]
  8. Simplified88.6%

    \[\leadsto \color{blue}{-\frac{v}{\mathsf{fma}\left(t1, \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}, t1\right)}} \]
  9. Taylor expanded in u around 0

    \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{t1 + u \cdot \left(2 + \frac{u}{t1}\right)}}\right) \]
  10. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{u \cdot \left(2 + \frac{u}{t1}\right) + t1}}\right) \]
    2. lower-fma.f64N/A

      \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{\mathsf{fma}\left(u, 2 + \frac{u}{t1}, t1\right)}}\right) \]
    3. lower-+.f64N/A

      \[\leadsto \mathsf{neg}\left(\frac{v}{\mathsf{fma}\left(u, \color{blue}{2 + \frac{u}{t1}}, t1\right)}\right) \]
    4. lower-/.f6495.9

      \[\leadsto -\frac{v}{\mathsf{fma}\left(u, 2 + \color{blue}{\frac{u}{t1}}, t1\right)} \]
  11. Simplified95.9%

    \[\leadsto -\frac{v}{\color{blue}{\mathsf{fma}\left(u, 2 + \frac{u}{t1}, t1\right)}} \]
  12. Taylor expanded in u around inf

    \[\leadsto \mathsf{neg}\left(\frac{v}{\mathsf{fma}\left(u, \color{blue}{\frac{u}{t1}}, t1\right)}\right) \]
  13. Step-by-step derivation
    1. lower-/.f6494.5

      \[\leadsto -\frac{v}{\mathsf{fma}\left(u, \color{blue}{\frac{u}{t1}}, t1\right)} \]
  14. Simplified94.5%

    \[\leadsto -\frac{v}{\mathsf{fma}\left(u, \color{blue}{\frac{u}{t1}}, t1\right)} \]
  15. Final simplification94.5%

    \[\leadsto \frac{-v}{\mathsf{fma}\left(u, \frac{u}{t1}, t1\right)} \]
  16. Add Preprocessing

Alternative 6: 56.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{v \cdot -0.5}{u}\\ \mathbf{if}\;u \leq -3.8 \cdot 10^{+79}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;u \leq 3.1 \cdot 10^{+105}:\\ \;\;\;\;-\frac{v}{t1}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (u v t1)
 :precision binary64
 (let* ((t_1 (/ (* v -0.5) u)))
   (if (<= u -3.8e+79) t_1 (if (<= u 3.1e+105) (- (/ v t1)) t_1))))
double code(double u, double v, double t1) {
	double t_1 = (v * -0.5) / u;
	double tmp;
	if (u <= -3.8e+79) {
		tmp = t_1;
	} else if (u <= 3.1e+105) {
		tmp = -(v / t1);
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(u, v, t1)
    real(8), intent (in) :: u
    real(8), intent (in) :: v
    real(8), intent (in) :: t1
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (v * (-0.5d0)) / u
    if (u <= (-3.8d+79)) then
        tmp = t_1
    else if (u <= 3.1d+105) then
        tmp = -(v / t1)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double u, double v, double t1) {
	double t_1 = (v * -0.5) / u;
	double tmp;
	if (u <= -3.8e+79) {
		tmp = t_1;
	} else if (u <= 3.1e+105) {
		tmp = -(v / t1);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(u, v, t1):
	t_1 = (v * -0.5) / u
	tmp = 0
	if u <= -3.8e+79:
		tmp = t_1
	elif u <= 3.1e+105:
		tmp = -(v / t1)
	else:
		tmp = t_1
	return tmp
function code(u, v, t1)
	t_1 = Float64(Float64(v * -0.5) / u)
	tmp = 0.0
	if (u <= -3.8e+79)
		tmp = t_1;
	elseif (u <= 3.1e+105)
		tmp = Float64(-Float64(v / t1));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(u, v, t1)
	t_1 = (v * -0.5) / u;
	tmp = 0.0;
	if (u <= -3.8e+79)
		tmp = t_1;
	elseif (u <= 3.1e+105)
		tmp = -(v / t1);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[(v * -0.5), $MachinePrecision] / u), $MachinePrecision]}, If[LessEqual[u, -3.8e+79], t$95$1, If[LessEqual[u, 3.1e+105], (-N[(v / t1), $MachinePrecision]), t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{v \cdot -0.5}{u}\\
\mathbf{if}\;u \leq -3.8 \cdot 10^{+79}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;u \leq 3.1 \cdot 10^{+105}:\\
\;\;\;\;-\frac{v}{t1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if u < -3.8000000000000002e79 or 3.10000000000000004e105 < u

    1. Initial program 84.7%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t1 around inf

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\color{blue}{{t1}^{2} \cdot \left(1 + \left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right)\right)}} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\color{blue}{{t1}^{2} \cdot \left(1 + \left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right)\right)}} \]
      2. unpow2N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\color{blue}{\left(t1 \cdot t1\right)} \cdot \left(1 + \left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right)\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\color{blue}{\left(t1 \cdot t1\right)} \cdot \left(1 + \left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right)\right)} \]
      4. +-commutativeN/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \color{blue}{\left(\left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right) + 1\right)}} \]
      5. +-commutativeN/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\color{blue}{\left(\frac{{u}^{2}}{{t1}^{2}} + 2 \cdot \frac{u}{t1}\right)} + 1\right)} \]
      6. unpow2N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\left(\frac{\color{blue}{u \cdot u}}{{t1}^{2}} + 2 \cdot \frac{u}{t1}\right) + 1\right)} \]
      7. unpow2N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\left(\frac{u \cdot u}{\color{blue}{t1 \cdot t1}} + 2 \cdot \frac{u}{t1}\right) + 1\right)} \]
      8. times-fracN/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\left(\color{blue}{\frac{u}{t1} \cdot \frac{u}{t1}} + 2 \cdot \frac{u}{t1}\right) + 1\right)} \]
      9. distribute-rgt-outN/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\color{blue}{\frac{u}{t1} \cdot \left(\frac{u}{t1} + 2\right)} + 1\right)} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \color{blue}{\mathsf{fma}\left(\frac{u}{t1}, \frac{u}{t1} + 2, 1\right)}} \]
      11. lower-/.f64N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \mathsf{fma}\left(\color{blue}{\frac{u}{t1}}, \frac{u}{t1} + 2, 1\right)} \]
      12. lower-+.f64N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \mathsf{fma}\left(\frac{u}{t1}, \color{blue}{\frac{u}{t1} + 2}, 1\right)} \]
      13. lower-/.f6453.6

        \[\leadsto \frac{\left(-t1\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \mathsf{fma}\left(\frac{u}{t1}, \color{blue}{\frac{u}{t1}} + 2, 1\right)} \]
    5. Simplified53.6%

      \[\leadsto \frac{\left(-t1\right) \cdot v}{\color{blue}{\left(t1 \cdot t1\right) \cdot \mathsf{fma}\left(\frac{u}{t1}, \frac{u}{t1} + 2, 1\right)}} \]
    6. Taylor expanded in v around 0

      \[\leadsto \color{blue}{-1 \cdot \frac{v}{t1 \cdot \left(1 + \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}\right)}} \]
    7. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{v}{t1 \cdot \left(1 + \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}\right)}\right)} \]
      2. lower-neg.f64N/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{v}{t1 \cdot \left(1 + \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}\right)}\right)} \]
      3. lower-/.f64N/A

        \[\leadsto \mathsf{neg}\left(\color{blue}{\frac{v}{t1 \cdot \left(1 + \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}\right)}}\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{t1 \cdot \color{blue}{\left(\frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1} + 1\right)}}\right) \]
      5. distribute-lft-inN/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{t1 \cdot \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1} + t1 \cdot 1}}\right) \]
      6. *-rgt-identityN/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{t1 \cdot \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1} + \color{blue}{t1}}\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{\mathsf{fma}\left(t1, \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}, t1\right)}}\right) \]
      8. lower-/.f64N/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{\mathsf{fma}\left(t1, \color{blue}{\frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}}, t1\right)}\right) \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{\mathsf{fma}\left(t1, \frac{\color{blue}{u \cdot \left(2 + \frac{u}{t1}\right)}}{t1}, t1\right)}\right) \]
      10. lower-+.f64N/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{\mathsf{fma}\left(t1, \frac{u \cdot \color{blue}{\left(2 + \frac{u}{t1}\right)}}{t1}, t1\right)}\right) \]
      11. lower-/.f6490.3

        \[\leadsto -\frac{v}{\mathsf{fma}\left(t1, \frac{u \cdot \left(2 + \color{blue}{\frac{u}{t1}}\right)}{t1}, t1\right)} \]
    8. Simplified90.3%

      \[\leadsto \color{blue}{-\frac{v}{\mathsf{fma}\left(t1, \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}, t1\right)}} \]
    9. Taylor expanded in u around 0

      \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{t1 + 2 \cdot u}}\right) \]
    10. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{2 \cdot u + t1}}\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{u \cdot 2} + t1}\right) \]
      3. lower-fma.f6450.5

        \[\leadsto -\frac{v}{\color{blue}{\mathsf{fma}\left(u, 2, t1\right)}} \]
    11. Simplified50.5%

      \[\leadsto -\frac{v}{\color{blue}{\mathsf{fma}\left(u, 2, t1\right)}} \]
    12. Taylor expanded in u around inf

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{v}{u}} \]
    13. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{\frac{-1}{2} \cdot v}{u}} \]
      2. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{-1}{2} \cdot v}{u}} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{v \cdot \frac{-1}{2}}}{u} \]
      4. lower-*.f6445.6

        \[\leadsto \frac{\color{blue}{v \cdot -0.5}}{u} \]
    14. Simplified45.6%

      \[\leadsto \color{blue}{\frac{v \cdot -0.5}{u}} \]

    if -3.8000000000000002e79 < u < 3.10000000000000004e105

    1. Initial program 72.5%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t1 around inf

      \[\leadsto \color{blue}{-1 \cdot \frac{v}{t1}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{-1 \cdot v}{t1}} \]
      2. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{-1 \cdot v}{t1}} \]
      3. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(v\right)}}{t1} \]
      4. lower-neg.f6470.5

        \[\leadsto \frac{\color{blue}{-v}}{t1} \]
    5. Simplified70.5%

      \[\leadsto \color{blue}{\frac{-v}{t1}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification62.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;u \leq -3.8 \cdot 10^{+79}:\\ \;\;\;\;\frac{v \cdot -0.5}{u}\\ \mathbf{elif}\;u \leq 3.1 \cdot 10^{+105}:\\ \;\;\;\;-\frac{v}{t1}\\ \mathbf{else}:\\ \;\;\;\;\frac{v \cdot -0.5}{u}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 61.1% accurate, 1.5× speedup?

\[\begin{array}{l} \\ -\frac{v}{\mathsf{fma}\left(u, 2, t1\right)} \end{array} \]
(FPCore (u v t1) :precision binary64 (- (/ v (fma u 2.0 t1))))
double code(double u, double v, double t1) {
	return -(v / fma(u, 2.0, t1));
}
function code(u, v, t1)
	return Float64(-Float64(v / fma(u, 2.0, t1)))
end
code[u_, v_, t1_] := (-N[(v / N[(u * 2.0 + t1), $MachinePrecision]), $MachinePrecision])
\begin{array}{l}

\\
-\frac{v}{\mathsf{fma}\left(u, 2, t1\right)}
\end{array}
Derivation
  1. Initial program 76.7%

    \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in t1 around inf

    \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\color{blue}{{t1}^{2} \cdot \left(1 + \left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right)\right)}} \]
  4. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\color{blue}{{t1}^{2} \cdot \left(1 + \left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right)\right)}} \]
    2. unpow2N/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\color{blue}{\left(t1 \cdot t1\right)} \cdot \left(1 + \left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right)\right)} \]
    3. lower-*.f64N/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\color{blue}{\left(t1 \cdot t1\right)} \cdot \left(1 + \left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right)\right)} \]
    4. +-commutativeN/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \color{blue}{\left(\left(2 \cdot \frac{u}{t1} + \frac{{u}^{2}}{{t1}^{2}}\right) + 1\right)}} \]
    5. +-commutativeN/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\color{blue}{\left(\frac{{u}^{2}}{{t1}^{2}} + 2 \cdot \frac{u}{t1}\right)} + 1\right)} \]
    6. unpow2N/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\left(\frac{\color{blue}{u \cdot u}}{{t1}^{2}} + 2 \cdot \frac{u}{t1}\right) + 1\right)} \]
    7. unpow2N/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\left(\frac{u \cdot u}{\color{blue}{t1 \cdot t1}} + 2 \cdot \frac{u}{t1}\right) + 1\right)} \]
    8. times-fracN/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\left(\color{blue}{\frac{u}{t1} \cdot \frac{u}{t1}} + 2 \cdot \frac{u}{t1}\right) + 1\right)} \]
    9. distribute-rgt-outN/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \left(\color{blue}{\frac{u}{t1} \cdot \left(\frac{u}{t1} + 2\right)} + 1\right)} \]
    10. lower-fma.f64N/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \color{blue}{\mathsf{fma}\left(\frac{u}{t1}, \frac{u}{t1} + 2, 1\right)}} \]
    11. lower-/.f64N/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \mathsf{fma}\left(\color{blue}{\frac{u}{t1}}, \frac{u}{t1} + 2, 1\right)} \]
    12. lower-+.f64N/A

      \[\leadsto \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \mathsf{fma}\left(\frac{u}{t1}, \color{blue}{\frac{u}{t1} + 2}, 1\right)} \]
    13. lower-/.f6455.4

      \[\leadsto \frac{\left(-t1\right) \cdot v}{\left(t1 \cdot t1\right) \cdot \mathsf{fma}\left(\frac{u}{t1}, \color{blue}{\frac{u}{t1}} + 2, 1\right)} \]
  5. Simplified55.4%

    \[\leadsto \frac{\left(-t1\right) \cdot v}{\color{blue}{\left(t1 \cdot t1\right) \cdot \mathsf{fma}\left(\frac{u}{t1}, \frac{u}{t1} + 2, 1\right)}} \]
  6. Taylor expanded in v around 0

    \[\leadsto \color{blue}{-1 \cdot \frac{v}{t1 \cdot \left(1 + \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}\right)}} \]
  7. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{v}{t1 \cdot \left(1 + \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}\right)}\right)} \]
    2. lower-neg.f64N/A

      \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{v}{t1 \cdot \left(1 + \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}\right)}\right)} \]
    3. lower-/.f64N/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\frac{v}{t1 \cdot \left(1 + \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}\right)}}\right) \]
    4. +-commutativeN/A

      \[\leadsto \mathsf{neg}\left(\frac{v}{t1 \cdot \color{blue}{\left(\frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1} + 1\right)}}\right) \]
    5. distribute-lft-inN/A

      \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{t1 \cdot \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1} + t1 \cdot 1}}\right) \]
    6. *-rgt-identityN/A

      \[\leadsto \mathsf{neg}\left(\frac{v}{t1 \cdot \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1} + \color{blue}{t1}}\right) \]
    7. lower-fma.f64N/A

      \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{\mathsf{fma}\left(t1, \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}, t1\right)}}\right) \]
    8. lower-/.f64N/A

      \[\leadsto \mathsf{neg}\left(\frac{v}{\mathsf{fma}\left(t1, \color{blue}{\frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}}, t1\right)}\right) \]
    9. lower-*.f64N/A

      \[\leadsto \mathsf{neg}\left(\frac{v}{\mathsf{fma}\left(t1, \frac{\color{blue}{u \cdot \left(2 + \frac{u}{t1}\right)}}{t1}, t1\right)}\right) \]
    10. lower-+.f64N/A

      \[\leadsto \mathsf{neg}\left(\frac{v}{\mathsf{fma}\left(t1, \frac{u \cdot \color{blue}{\left(2 + \frac{u}{t1}\right)}}{t1}, t1\right)}\right) \]
    11. lower-/.f6488.6

      \[\leadsto -\frac{v}{\mathsf{fma}\left(t1, \frac{u \cdot \left(2 + \color{blue}{\frac{u}{t1}}\right)}{t1}, t1\right)} \]
  8. Simplified88.6%

    \[\leadsto \color{blue}{-\frac{v}{\mathsf{fma}\left(t1, \frac{u \cdot \left(2 + \frac{u}{t1}\right)}{t1}, t1\right)}} \]
  9. Taylor expanded in u around 0

    \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{t1 + 2 \cdot u}}\right) \]
  10. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{2 \cdot u + t1}}\right) \]
    2. *-commutativeN/A

      \[\leadsto \mathsf{neg}\left(\frac{v}{\color{blue}{u \cdot 2} + t1}\right) \]
    3. lower-fma.f6463.1

      \[\leadsto -\frac{v}{\color{blue}{\mathsf{fma}\left(u, 2, t1\right)}} \]
  11. Simplified63.1%

    \[\leadsto -\frac{v}{\color{blue}{\mathsf{fma}\left(u, 2, t1\right)}} \]
  12. Add Preprocessing

Alternative 8: 53.3% accurate, 2.1× speedup?

\[\begin{array}{l} \\ -\frac{v}{t1} \end{array} \]
(FPCore (u v t1) :precision binary64 (- (/ v t1)))
double code(double u, double v, double t1) {
	return -(v / t1);
}
real(8) function code(u, v, t1)
    real(8), intent (in) :: u
    real(8), intent (in) :: v
    real(8), intent (in) :: t1
    code = -(v / t1)
end function
public static double code(double u, double v, double t1) {
	return -(v / t1);
}
def code(u, v, t1):
	return -(v / t1)
function code(u, v, t1)
	return Float64(-Float64(v / t1))
end
function tmp = code(u, v, t1)
	tmp = -(v / t1);
end
code[u_, v_, t1_] := (-N[(v / t1), $MachinePrecision])
\begin{array}{l}

\\
-\frac{v}{t1}
\end{array}
Derivation
  1. Initial program 76.7%

    \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in t1 around inf

    \[\leadsto \color{blue}{-1 \cdot \frac{v}{t1}} \]
  4. Step-by-step derivation
    1. associate-*r/N/A

      \[\leadsto \color{blue}{\frac{-1 \cdot v}{t1}} \]
    2. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{-1 \cdot v}{t1}} \]
    3. mul-1-negN/A

      \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(v\right)}}{t1} \]
    4. lower-neg.f6453.9

      \[\leadsto \frac{\color{blue}{-v}}{t1} \]
  5. Simplified53.9%

    \[\leadsto \color{blue}{\frac{-v}{t1}} \]
  6. Final simplification53.9%

    \[\leadsto -\frac{v}{t1} \]
  7. Add Preprocessing

Reproduce

?
herbie shell --seed 2024215 
(FPCore (u v t1)
  :name "Rosa's DopplerBench"
  :precision binary64
  (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))