Rosa's DopplerBench

Percentage Accurate: 72.8% → 98.6%
Time: 10.5s
Alternatives: 10
Speedup: 0.8×

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 10 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.8% 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: 98.6% accurate, 0.4× speedup?

\[\begin{array}{l} v\_m = \left|v\right| \\ v\_s = \mathsf{copysign}\left(1, v\right) \\ v\_s \cdot \begin{array}{l} \mathbf{if}\;\frac{t1 \cdot v\_m}{\left(-\left(u + t1\right)\right) \cdot \left(u + t1\right)} \leq -5 \cdot 10^{+68}:\\ \;\;\;\;\frac{-v\_m}{\mathsf{fma}\left(2 + \frac{u}{t1}, u, t1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{-t1}{u + t1} \cdot \frac{v\_m}{u + t1}\\ \end{array} \end{array} \]
v\_m = (fabs.f64 v)
v\_s = (copysign.f64 #s(literal 1 binary64) v)
(FPCore (v_s u v_m t1)
 :precision binary64
 (*
  v_s
  (if (<= (/ (* t1 v_m) (* (- (+ u t1)) (+ u t1))) -5e+68)
    (/ (- v_m) (fma (+ 2.0 (/ u t1)) u t1))
    (* (/ (- t1) (+ u t1)) (/ v_m (+ u t1))))))
v\_m = fabs(v);
v\_s = copysign(1.0, v);
double code(double v_s, double u, double v_m, double t1) {
	double tmp;
	if (((t1 * v_m) / (-(u + t1) * (u + t1))) <= -5e+68) {
		tmp = -v_m / fma((2.0 + (u / t1)), u, t1);
	} else {
		tmp = (-t1 / (u + t1)) * (v_m / (u + t1));
	}
	return v_s * tmp;
}
v\_m = abs(v)
v\_s = copysign(1.0, v)
function code(v_s, u, v_m, t1)
	tmp = 0.0
	if (Float64(Float64(t1 * v_m) / Float64(Float64(-Float64(u + t1)) * Float64(u + t1))) <= -5e+68)
		tmp = Float64(Float64(-v_m) / fma(Float64(2.0 + Float64(u / t1)), u, t1));
	else
		tmp = Float64(Float64(Float64(-t1) / Float64(u + t1)) * Float64(v_m / Float64(u + t1)));
	end
	return Float64(v_s * tmp)
end
v\_m = N[Abs[v], $MachinePrecision]
v\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[v]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[v$95$s_, u_, v$95$m_, t1_] := N[(v$95$s * If[LessEqual[N[(N[(t1 * v$95$m), $MachinePrecision] / N[((-N[(u + t1), $MachinePrecision]) * N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e+68], N[((-v$95$m) / N[(N[(2.0 + N[(u / t1), $MachinePrecision]), $MachinePrecision] * u + t1), $MachinePrecision]), $MachinePrecision], N[(N[((-t1) / N[(u + t1), $MachinePrecision]), $MachinePrecision] * N[(v$95$m / N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
v\_m = \left|v\right|
\\
v\_s = \mathsf{copysign}\left(1, v\right)

\\
v\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{t1 \cdot v\_m}{\left(-\left(u + t1\right)\right) \cdot \left(u + t1\right)} \leq -5 \cdot 10^{+68}:\\
\;\;\;\;\frac{-v\_m}{\mathsf{fma}\left(2 + \frac{u}{t1}, u, t1\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{-t1}{u + t1} \cdot \frac{v\_m}{u + t1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 (neg.f64 t1) v) (*.f64 (+.f64 t1 u) (+.f64 t1 u))) < -5.0000000000000004e68

    1. Initial program 76.0%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(v\right)\right)} \cdot \frac{t1}{t1 + u}}{t1 + u} \]
      14. lower-/.f6499.6

        \[\leadsto \frac{\left(-v\right) \cdot \color{blue}{\frac{t1}{t1 + u}}}{t1 + u} \]
      15. lift-+.f64N/A

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

        \[\leadsto \frac{\left(\mathsf{neg}\left(v\right)\right) \cdot \frac{t1}{\color{blue}{u + t1}}}{t1 + u} \]
      17. lower-+.f6499.6

        \[\leadsto \frac{\left(-v\right) \cdot \frac{t1}{\color{blue}{u + t1}}}{t1 + u} \]
      18. lift-+.f64N/A

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

        \[\leadsto \frac{\left(\mathsf{neg}\left(v\right)\right) \cdot \frac{t1}{u + t1}}{\color{blue}{u + t1}} \]
      20. lower-+.f6499.6

        \[\leadsto \frac{\left(-v\right) \cdot \frac{t1}{u + t1}}{\color{blue}{u + t1}} \]
    4. Applied rewrites99.6%

      \[\leadsto \color{blue}{\frac{\left(-v\right) \cdot \frac{t1}{u + t1}}{u + t1}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-v}{\color{blue}{\frac{u + t1}{t1}} \cdot \left(u + t1\right)} \]
    6. Applied rewrites99.9%

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

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

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

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

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

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

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

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

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

    if -5.0000000000000004e68 < (/.f64 (*.f64 (neg.f64 t1) v) (*.f64 (+.f64 t1 u) (+.f64 t1 u)))

    1. Initial program 77.8%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

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

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

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

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

        \[\leadsto \frac{v \cdot \color{blue}{\left(-1 \cdot t1\right)}}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
      6. associate-*r*N/A

        \[\leadsto \frac{\color{blue}{\left(v \cdot -1\right) \cdot t1}}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
      7. lift-*.f64N/A

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

        \[\leadsto \color{blue}{\frac{v \cdot -1}{t1 + u} \cdot \frac{t1}{t1 + u}} \]
      9. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{-1 \cdot v}}{t1 + u} \cdot \frac{t1}{t1 + u} \]
      10. neg-mul-1N/A

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{neg}\left(v\right)}{\color{blue}{u + t1}} \cdot \frac{t1}{t1 + u} \]
      17. lower-/.f6498.5

        \[\leadsto \frac{-v}{u + t1} \cdot \color{blue}{\frac{t1}{t1 + u}} \]
      18. lift-+.f64N/A

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

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

        \[\leadsto \frac{-v}{u + t1} \cdot \frac{t1}{\color{blue}{u + t1}} \]
    4. Applied rewrites98.5%

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

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

Alternative 2: 88.8% accurate, 0.7× speedup?

\[\begin{array}{l} v\_m = \left|v\right| \\ v\_s = \mathsf{copysign}\left(1, v\right) \\ \begin{array}{l} t_1 := \frac{-v\_m}{\mathsf{fma}\left(2, u, t1\right)}\\ v\_s \cdot \begin{array}{l} \mathbf{if}\;t1 \leq -8 \cdot 10^{+141}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t1 \leq 6 \cdot 10^{+144}:\\ \;\;\;\;\frac{-t1}{\left(u + t1\right) \cdot \left(u + t1\right)} \cdot v\_m\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \end{array} \]
v\_m = (fabs.f64 v)
v\_s = (copysign.f64 #s(literal 1 binary64) v)
(FPCore (v_s u v_m t1)
 :precision binary64
 (let* ((t_1 (/ (- v_m) (fma 2.0 u t1))))
   (*
    v_s
    (if (<= t1 -8e+141)
      t_1
      (if (<= t1 6e+144) (* (/ (- t1) (* (+ u t1) (+ u t1))) v_m) t_1)))))
v\_m = fabs(v);
v\_s = copysign(1.0, v);
double code(double v_s, double u, double v_m, double t1) {
	double t_1 = -v_m / fma(2.0, u, t1);
	double tmp;
	if (t1 <= -8e+141) {
		tmp = t_1;
	} else if (t1 <= 6e+144) {
		tmp = (-t1 / ((u + t1) * (u + t1))) * v_m;
	} else {
		tmp = t_1;
	}
	return v_s * tmp;
}
v\_m = abs(v)
v\_s = copysign(1.0, v)
function code(v_s, u, v_m, t1)
	t_1 = Float64(Float64(-v_m) / fma(2.0, u, t1))
	tmp = 0.0
	if (t1 <= -8e+141)
		tmp = t_1;
	elseif (t1 <= 6e+144)
		tmp = Float64(Float64(Float64(-t1) / Float64(Float64(u + t1) * Float64(u + t1))) * v_m);
	else
		tmp = t_1;
	end
	return Float64(v_s * tmp)
end
v\_m = N[Abs[v], $MachinePrecision]
v\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[v]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[v$95$s_, u_, v$95$m_, t1_] := Block[{t$95$1 = N[((-v$95$m) / N[(2.0 * u + t1), $MachinePrecision]), $MachinePrecision]}, N[(v$95$s * If[LessEqual[t1, -8e+141], t$95$1, If[LessEqual[t1, 6e+144], N[(N[((-t1) / N[(N[(u + t1), $MachinePrecision] * N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * v$95$m), $MachinePrecision], t$95$1]]), $MachinePrecision]]
\begin{array}{l}
v\_m = \left|v\right|
\\
v\_s = \mathsf{copysign}\left(1, v\right)

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

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

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t1 < -8.00000000000000014e141 or 5.9999999999999998e144 < t1

    1. Initial program 42.8%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(v\right)\right)} \cdot \frac{t1}{t1 + u}}{t1 + u} \]
      14. lower-/.f64100.0

        \[\leadsto \frac{\left(-v\right) \cdot \color{blue}{\frac{t1}{t1 + u}}}{t1 + u} \]
      15. lift-+.f64N/A

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

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

        \[\leadsto \frac{\left(-v\right) \cdot \frac{t1}{\color{blue}{u + t1}}}{t1 + u} \]
      18. lift-+.f64N/A

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

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

        \[\leadsto \frac{\left(-v\right) \cdot \frac{t1}{u + t1}}{\color{blue}{u + t1}} \]
    4. Applied rewrites100.0%

      \[\leadsto \color{blue}{\frac{\left(-v\right) \cdot \frac{t1}{u + t1}}{u + t1}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-v}{\color{blue}{\frac{u + t1}{t1}} \cdot \left(u + t1\right)} \]
    6. Applied rewrites97.9%

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

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

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

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

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

    if -8.00000000000000014e141 < t1 < 5.9999999999999998e144

    1. Initial program 83.6%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-t1}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \cdot v \]
      8. lift-+.f64N/A

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

        \[\leadsto \frac{\mathsf{neg}\left(t1\right)}{\color{blue}{\left(u + t1\right)} \cdot \left(t1 + u\right)} \cdot v \]
      10. lower-+.f6487.6

        \[\leadsto \frac{-t1}{\color{blue}{\left(u + t1\right)} \cdot \left(t1 + u\right)} \cdot v \]
      11. lift-+.f64N/A

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

        \[\leadsto \frac{\mathsf{neg}\left(t1\right)}{\left(u + t1\right) \cdot \color{blue}{\left(u + t1\right)}} \cdot v \]
      13. lower-+.f6487.6

        \[\leadsto \frac{-t1}{\left(u + t1\right) \cdot \color{blue}{\left(u + t1\right)}} \cdot v \]
    4. Applied rewrites87.6%

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

Reproduce

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