Rosa's DopplerBench

Percentage Accurate: 72.6% → 98.0%
Time: 12.6s
Alternatives: 9
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 9 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.6% 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.0% accurate, 1.0× speedup?

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

\\
\frac{\frac{t1}{t1 + u} \cdot \left(-v\right)}{t1 + u}
\end{array}
Derivation
  1. Initial program 71.6%

    \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
  2. Step-by-step derivation
    1. associate-/l*73.0%

      \[\leadsto \color{blue}{\left(-t1\right) \cdot \frac{v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
    2. distribute-lft-neg-out73.0%

      \[\leadsto \color{blue}{-t1 \cdot \frac{v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
    3. distribute-rgt-neg-in73.0%

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

      \[\leadsto t1 \cdot \left(-\color{blue}{\frac{\frac{v}{t1 + u}}{t1 + u}}\right) \]
    5. distribute-neg-frac282.0%

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

    \[\leadsto \color{blue}{t1 \cdot \frac{\frac{v}{t1 + u}}{-\left(t1 + u\right)}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. associate-*r/97.4%

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

      \[\leadsto \frac{t1 \cdot \frac{v}{t1 + u}}{-\color{blue}{\left(u + t1\right)}} \]
    3. distribute-neg-in97.4%

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

      \[\leadsto \frac{t1 \cdot \frac{v}{t1 + u}}{\color{blue}{\left(-u\right) - t1}} \]
    5. associate-*l/97.8%

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

      \[\leadsto \frac{t1}{\left(-u\right) - t1} \cdot \color{blue}{\frac{-v}{-\left(t1 + u\right)}} \]
    7. associate-*r/98.3%

      \[\leadsto \color{blue}{\frac{\frac{t1}{\left(-u\right) - t1} \cdot \left(-v\right)}{-\left(t1 + u\right)}} \]
    8. remove-double-neg98.3%

      \[\leadsto \frac{\frac{\color{blue}{-\left(-t1\right)}}{\left(-u\right) - t1} \cdot \left(-v\right)}{-\left(t1 + u\right)} \]
    9. sub-neg98.3%

      \[\leadsto \frac{\frac{-\left(-t1\right)}{\color{blue}{\left(-u\right) + \left(-t1\right)}} \cdot \left(-v\right)}{-\left(t1 + u\right)} \]
    10. distribute-neg-in98.3%

      \[\leadsto \frac{\frac{-\left(-t1\right)}{\color{blue}{-\left(u + t1\right)}} \cdot \left(-v\right)}{-\left(t1 + u\right)} \]
    11. +-commutative98.3%

      \[\leadsto \frac{\frac{-\left(-t1\right)}{-\color{blue}{\left(t1 + u\right)}} \cdot \left(-v\right)}{-\left(t1 + u\right)} \]
    12. frac-2neg98.3%

      \[\leadsto \frac{\color{blue}{\frac{-t1}{t1 + u}} \cdot \left(-v\right)}{-\left(t1 + u\right)} \]
    13. add-sqr-sqrt50.6%

      \[\leadsto \frac{\frac{\color{blue}{\sqrt{-t1} \cdot \sqrt{-t1}}}{t1 + u} \cdot \left(-v\right)}{-\left(t1 + u\right)} \]
    14. sqrt-unprod42.4%

      \[\leadsto \frac{\frac{\color{blue}{\sqrt{\left(-t1\right) \cdot \left(-t1\right)}}}{t1 + u} \cdot \left(-v\right)}{-\left(t1 + u\right)} \]
    15. sqr-neg42.4%

      \[\leadsto \frac{\frac{\sqrt{\color{blue}{t1 \cdot t1}}}{t1 + u} \cdot \left(-v\right)}{-\left(t1 + u\right)} \]
    16. sqrt-unprod19.5%

      \[\leadsto \frac{\frac{\color{blue}{\sqrt{t1} \cdot \sqrt{t1}}}{t1 + u} \cdot \left(-v\right)}{-\left(t1 + u\right)} \]
    17. add-sqr-sqrt40.8%

      \[\leadsto \frac{\frac{\color{blue}{t1}}{t1 + u} \cdot \left(-v\right)}{-\left(t1 + u\right)} \]
    18. add-sqr-sqrt17.8%

      \[\leadsto \frac{\frac{t1}{t1 + u} \cdot \left(-v\right)}{\color{blue}{\sqrt{-\left(t1 + u\right)} \cdot \sqrt{-\left(t1 + u\right)}}} \]
    19. sqrt-unprod58.5%

      \[\leadsto \frac{\frac{t1}{t1 + u} \cdot \left(-v\right)}{\color{blue}{\sqrt{\left(-\left(t1 + u\right)\right) \cdot \left(-\left(t1 + u\right)\right)}}} \]
  6. Applied egg-rr98.3%

    \[\leadsto \color{blue}{\frac{\frac{t1}{t1 + u} \cdot \left(-v\right)}{t1 + u}} \]
  7. Add Preprocessing

Alternative 2: 89.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := -1 \cdot \frac{v}{t1}\\ \mathbf{if}\;t1 \leq -7.5 \cdot 10^{+168}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t1 \leq 1.8 \cdot 10^{+157}:\\ \;\;\;\;t1 \cdot \frac{\frac{v}{t1 + u}}{-\left(t1 + u\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (u v t1)
 :precision binary64
 (let* ((t_1 (* -1.0 (/ v t1))))
   (if (<= t1 -7.5e+168)
     t_1
     (if (<= t1 1.8e+157) (* t1 (/ (/ v (+ t1 u)) (- (+ t1 u)))) t_1))))
double code(double u, double v, double t1) {
	double t_1 = -1.0 * (v / t1);
	double tmp;
	if (t1 <= -7.5e+168) {
		tmp = t_1;
	} else if (t1 <= 1.8e+157) {
		tmp = t1 * ((v / (t1 + u)) / -(t1 + u));
	} 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 = (-1.0d0) * (v / t1)
    if (t1 <= (-7.5d+168)) then
        tmp = t_1
    else if (t1 <= 1.8d+157) then
        tmp = t1 * ((v / (t1 + u)) / -(t1 + u))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double u, double v, double t1) {
	double t_1 = -1.0 * (v / t1);
	double tmp;
	if (t1 <= -7.5e+168) {
		tmp = t_1;
	} else if (t1 <= 1.8e+157) {
		tmp = t1 * ((v / (t1 + u)) / -(t1 + u));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(u, v, t1):
	t_1 = -1.0 * (v / t1)
	tmp = 0
	if t1 <= -7.5e+168:
		tmp = t_1
	elif t1 <= 1.8e+157:
		tmp = t1 * ((v / (t1 + u)) / -(t1 + u))
	else:
		tmp = t_1
	return tmp
function code(u, v, t1)
	t_1 = Float64(-1.0 * Float64(v / t1))
	tmp = 0.0
	if (t1 <= -7.5e+168)
		tmp = t_1;
	elseif (t1 <= 1.8e+157)
		tmp = Float64(t1 * Float64(Float64(v / Float64(t1 + u)) / Float64(-Float64(t1 + u))));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(u, v, t1)
	t_1 = -1.0 * (v / t1);
	tmp = 0.0;
	if (t1 <= -7.5e+168)
		tmp = t_1;
	elseif (t1 <= 1.8e+157)
		tmp = t1 * ((v / (t1 + u)) / -(t1 + u));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[u_, v_, t1_] := Block[{t$95$1 = N[(-1.0 * N[(v / t1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -7.5e+168], t$95$1, If[LessEqual[t1, 1.8e+157], N[(t1 * N[(N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision] / (-N[(t1 + u), $MachinePrecision])), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := -1 \cdot \frac{v}{t1}\\
\mathbf{if}\;t1 \leq -7.5 \cdot 10^{+168}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t1 < -7.4999999999999999e168 or 1.80000000000000012e157 < t1

    1. Initial program 42.5%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Step-by-step derivation
      1. associate-/l*43.6%

        \[\leadsto \color{blue}{\left(-t1\right) \cdot \frac{v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      2. distribute-lft-neg-out43.6%

        \[\leadsto \color{blue}{-t1 \cdot \frac{v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      3. distribute-rgt-neg-in43.6%

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

        \[\leadsto t1 \cdot \left(-\color{blue}{\frac{\frac{v}{t1 + u}}{t1 + u}}\right) \]
      5. distribute-neg-frac257.0%

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

      \[\leadsto \color{blue}{t1 \cdot \frac{\frac{v}{t1 + u}}{-\left(t1 + u\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in t1 around inf 87.4%

      \[\leadsto \color{blue}{-1 \cdot \frac{v}{t1}} \]

    if -7.4999999999999999e168 < t1 < 1.80000000000000012e157

    1. Initial program 83.0%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Step-by-step derivation
      1. associate-/l*84.5%

        \[\leadsto \color{blue}{\left(-t1\right) \cdot \frac{v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      2. distribute-lft-neg-out84.5%

        \[\leadsto \color{blue}{-t1 \cdot \frac{v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      3. distribute-rgt-neg-in84.5%

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

        \[\leadsto t1 \cdot \left(-\color{blue}{\frac{\frac{v}{t1 + u}}{t1 + u}}\right) \]
      5. distribute-neg-frac291.8%

        \[\leadsto t1 \cdot \color{blue}{\frac{\frac{v}{t1 + u}}{-\left(t1 + u\right)}} \]
    3. Simplified91.8%

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

Alternative 3: 77.9% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := -\frac{v}{t1 + u} \cdot \frac{t1}{u}\\ \mathbf{if}\;u \leq -5.8 \cdot 10^{+56}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;u \leq 1.2 \cdot 10^{-74}:\\ \;\;\;\;-1 \cdot \frac{v}{t1}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (u v t1)
 :precision binary64
 (let* ((t_1 (- (* (/ v (+ t1 u)) (/ t1 u)))))
   (if (<= u -5.8e+56) t_1 (if (<= u 1.2e-74) (* -1.0 (/ v t1)) t_1))))
double code(double u, double v, double t1) {
	double t_1 = -((v / (t1 + u)) * (t1 / u));
	double tmp;
	if (u <= -5.8e+56) {
		tmp = t_1;
	} else if (u <= 1.2e-74) {
		tmp = -1.0 * (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 / (t1 + u)) * (t1 / u))
    if (u <= (-5.8d+56)) then
        tmp = t_1
    else if (u <= 1.2d-74) then
        tmp = (-1.0d0) * (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 / (t1 + u)) * (t1 / u));
	double tmp;
	if (u <= -5.8e+56) {
		tmp = t_1;
	} else if (u <= 1.2e-74) {
		tmp = -1.0 * (v / t1);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(u, v, t1):
	t_1 = -((v / (t1 + u)) * (t1 / u))
	tmp = 0
	if u <= -5.8e+56:
		tmp = t_1
	elif u <= 1.2e-74:
		tmp = -1.0 * (v / t1)
	else:
		tmp = t_1
	return tmp
function code(u, v, t1)
	t_1 = Float64(-Float64(Float64(v / Float64(t1 + u)) * Float64(t1 / u)))
	tmp = 0.0
	if (u <= -5.8e+56)
		tmp = t_1;
	elseif (u <= 1.2e-74)
		tmp = Float64(-1.0 * Float64(v / t1));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(u, v, t1)
	t_1 = -((v / (t1 + u)) * (t1 / u));
	tmp = 0.0;
	if (u <= -5.8e+56)
		tmp = t_1;
	elseif (u <= 1.2e-74)
		tmp = -1.0 * (v / t1);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[u_, v_, t1_] := Block[{t$95$1 = (-N[(N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision] * N[(t1 / u), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[u, -5.8e+56], t$95$1, If[LessEqual[u, 1.2e-74], N[(-1.0 * N[(v / t1), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := -\frac{v}{t1 + u} \cdot \frac{t1}{u}\\
\mathbf{if}\;u \leq -5.8 \cdot 10^{+56}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;u \leq 1.2 \cdot 10^{-74}:\\
\;\;\;\;-1 \cdot \frac{v}{t1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if u < -5.80000000000000014e56 or 1.1999999999999999e-74 < u

    1. Initial program 79.8%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Step-by-step derivation
      1. associate-/l*81.1%

        \[\leadsto \color{blue}{\left(-t1\right) \cdot \frac{v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      2. distribute-lft-neg-out81.1%

        \[\leadsto \color{blue}{-t1 \cdot \frac{v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      3. distribute-rgt-neg-in81.1%

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

        \[\leadsto t1 \cdot \left(-\color{blue}{\frac{\frac{v}{t1 + u}}{t1 + u}}\right) \]
      5. distribute-neg-frac290.6%

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

      \[\leadsto \color{blue}{t1 \cdot \frac{\frac{v}{t1 + u}}{-\left(t1 + u\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in t1 around 0 86.8%

      \[\leadsto t1 \cdot \frac{\color{blue}{\frac{v}{u}}}{-\left(t1 + u\right)} \]
    6. Step-by-step derivation
      1. distribute-frac-neg286.8%

        \[\leadsto t1 \cdot \color{blue}{\left(-\frac{\frac{v}{u}}{t1 + u}\right)} \]
      2. add-sqr-sqrt52.6%

        \[\leadsto t1 \cdot \left(-\frac{\frac{v}{u}}{\color{blue}{\sqrt{t1 + u} \cdot \sqrt{t1 + u}}}\right) \]
      3. sqrt-unprod75.3%

        \[\leadsto t1 \cdot \left(-\frac{\frac{v}{u}}{\color{blue}{\sqrt{\left(t1 + u\right) \cdot \left(t1 + u\right)}}}\right) \]
      4. sqr-neg75.3%

        \[\leadsto t1 \cdot \left(-\frac{\frac{v}{u}}{\sqrt{\color{blue}{\left(-\left(t1 + u\right)\right) \cdot \left(-\left(t1 + u\right)\right)}}}\right) \]
      5. sqrt-unprod26.9%

        \[\leadsto t1 \cdot \left(-\frac{\frac{v}{u}}{\color{blue}{\sqrt{-\left(t1 + u\right)} \cdot \sqrt{-\left(t1 + u\right)}}}\right) \]
      6. add-sqr-sqrt63.8%

        \[\leadsto t1 \cdot \left(-\frac{\frac{v}{u}}{\color{blue}{-\left(t1 + u\right)}}\right) \]
      7. associate-/l/64.0%

        \[\leadsto t1 \cdot \left(-\color{blue}{\frac{v}{\left(-\left(t1 + u\right)\right) \cdot u}}\right) \]
      8. add-sqr-sqrt26.9%

        \[\leadsto t1 \cdot \left(-\frac{v}{\color{blue}{\left(\sqrt{-\left(t1 + u\right)} \cdot \sqrt{-\left(t1 + u\right)}\right)} \cdot u}\right) \]
      9. sqrt-unprod75.3%

        \[\leadsto t1 \cdot \left(-\frac{v}{\color{blue}{\sqrt{\left(-\left(t1 + u\right)\right) \cdot \left(-\left(t1 + u\right)\right)}} \cdot u}\right) \]
      10. sqr-neg75.3%

        \[\leadsto t1 \cdot \left(-\frac{v}{\sqrt{\color{blue}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \cdot u}\right) \]
      11. sqrt-unprod48.3%

        \[\leadsto t1 \cdot \left(-\frac{v}{\color{blue}{\left(\sqrt{t1 + u} \cdot \sqrt{t1 + u}\right)} \cdot u}\right) \]
      12. add-sqr-sqrt78.9%

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

      \[\leadsto t1 \cdot \color{blue}{\left(-\frac{v}{\left(t1 + u\right) \cdot u}\right)} \]
    8. Step-by-step derivation
      1. distribute-rgt-neg-out78.9%

        \[\leadsto \color{blue}{-t1 \cdot \frac{v}{\left(t1 + u\right) \cdot u}} \]
      2. associate-*r/77.6%

        \[\leadsto -\color{blue}{\frac{t1 \cdot v}{\left(t1 + u\right) \cdot u}} \]
      3. associate-/l/82.2%

        \[\leadsto -\color{blue}{\frac{\frac{t1 \cdot v}{u}}{t1 + u}} \]
      4. div-inv82.1%

        \[\leadsto -\color{blue}{\frac{t1 \cdot v}{u} \cdot \frac{1}{t1 + u}} \]
      5. add-sqr-sqrt54.3%

        \[\leadsto -\color{blue}{\left(\sqrt{\frac{t1 \cdot v}{u}} \cdot \sqrt{\frac{t1 \cdot v}{u}}\right)} \cdot \frac{1}{t1 + u} \]
      6. sqrt-unprod66.3%

        \[\leadsto -\color{blue}{\sqrt{\frac{t1 \cdot v}{u} \cdot \frac{t1 \cdot v}{u}}} \cdot \frac{1}{t1 + u} \]
      7. sqr-neg66.3%

        \[\leadsto -\sqrt{\color{blue}{\left(-\frac{t1 \cdot v}{u}\right) \cdot \left(-\frac{t1 \cdot v}{u}\right)}} \cdot \frac{1}{t1 + u} \]
      8. mul-1-neg66.3%

        \[\leadsto -\sqrt{\color{blue}{\left(-1 \cdot \frac{t1 \cdot v}{u}\right)} \cdot \left(-\frac{t1 \cdot v}{u}\right)} \cdot \frac{1}{t1 + u} \]
      9. mul-1-neg66.3%

        \[\leadsto -\sqrt{\left(-1 \cdot \frac{t1 \cdot v}{u}\right) \cdot \color{blue}{\left(-1 \cdot \frac{t1 \cdot v}{u}\right)}} \cdot \frac{1}{t1 + u} \]
      10. sqrt-unprod50.8%

        \[\leadsto -\color{blue}{\left(\sqrt{-1 \cdot \frac{t1 \cdot v}{u}} \cdot \sqrt{-1 \cdot \frac{t1 \cdot v}{u}}\right)} \cdot \frac{1}{t1 + u} \]
      11. add-sqr-sqrt58.0%

        \[\leadsto -\color{blue}{\left(-1 \cdot \frac{t1 \cdot v}{u}\right)} \cdot \frac{1}{t1 + u} \]
      12. mul-1-neg58.0%

        \[\leadsto -\color{blue}{\left(-\frac{t1 \cdot v}{u}\right)} \cdot \frac{1}{t1 + u} \]
      13. distribute-neg-frac58.0%

        \[\leadsto -\color{blue}{\frac{-t1 \cdot v}{u}} \cdot \frac{1}{t1 + u} \]
      14. associate-*l/58.0%

        \[\leadsto -\color{blue}{\frac{\left(-t1 \cdot v\right) \cdot \frac{1}{t1 + u}}{u}} \]
    9. Applied egg-rr82.2%

      \[\leadsto \color{blue}{-\frac{\frac{t1 \cdot v}{t1 + u}}{u}} \]
    10. Step-by-step derivation
      1. associate-*r/92.9%

        \[\leadsto -\frac{\color{blue}{t1 \cdot \frac{v}{t1 + u}}}{u} \]
      2. *-commutative92.9%

        \[\leadsto -\frac{\color{blue}{\frac{v}{t1 + u} \cdot t1}}{u} \]
      3. associate-/l*91.9%

        \[\leadsto -\color{blue}{\frac{v}{t1 + u} \cdot \frac{t1}{u}} \]
    11. Applied egg-rr91.9%

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

    if -5.80000000000000014e56 < u < 1.1999999999999999e-74

    1. Initial program 63.2%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Step-by-step derivation
      1. associate-/l*64.6%

        \[\leadsto \color{blue}{\left(-t1\right) \cdot \frac{v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      2. distribute-lft-neg-out64.6%

        \[\leadsto \color{blue}{-t1 \cdot \frac{v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      3. distribute-rgt-neg-in64.6%

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

        \[\leadsto t1 \cdot \left(-\color{blue}{\frac{\frac{v}{t1 + u}}{t1 + u}}\right) \]
      5. distribute-neg-frac273.1%

        \[\leadsto t1 \cdot \color{blue}{\frac{\frac{v}{t1 + u}}{-\left(t1 + u\right)}} \]
    3. Simplified73.1%

      \[\leadsto \color{blue}{t1 \cdot \frac{\frac{v}{t1 + u}}{-\left(t1 + u\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in t1 around inf 79.4%

      \[\leadsto \color{blue}{-1 \cdot \frac{v}{t1}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 78.3% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{-v}{t1 + u}\\ \mathbf{if}\;t1 \leq -7.5 \cdot 10^{-37}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t1 \leq 1.9 \cdot 10^{-10}:\\ \;\;\;\;-\frac{\frac{t1 \cdot v}{u}}{u}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (u v t1)
 :precision binary64
 (let* ((t_1 (/ (- v) (+ t1 u))))
   (if (<= t1 -7.5e-37)
     t_1
     (if (<= t1 1.9e-10) (- (/ (/ (* t1 v) u) u)) t_1))))
double code(double u, double v, double t1) {
	double t_1 = -v / (t1 + u);
	double tmp;
	if (t1 <= -7.5e-37) {
		tmp = t_1;
	} else if (t1 <= 1.9e-10) {
		tmp = -(((t1 * v) / u) / u);
	} 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 / (t1 + u)
    if (t1 <= (-7.5d-37)) then
        tmp = t_1
    else if (t1 <= 1.9d-10) then
        tmp = -(((t1 * v) / u) / u)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double u, double v, double t1) {
	double t_1 = -v / (t1 + u);
	double tmp;
	if (t1 <= -7.5e-37) {
		tmp = t_1;
	} else if (t1 <= 1.9e-10) {
		tmp = -(((t1 * v) / u) / u);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(u, v, t1):
	t_1 = -v / (t1 + u)
	tmp = 0
	if t1 <= -7.5e-37:
		tmp = t_1
	elif t1 <= 1.9e-10:
		tmp = -(((t1 * v) / u) / u)
	else:
		tmp = t_1
	return tmp
function code(u, v, t1)
	t_1 = Float64(Float64(-v) / Float64(t1 + u))
	tmp = 0.0
	if (t1 <= -7.5e-37)
		tmp = t_1;
	elseif (t1 <= 1.9e-10)
		tmp = Float64(-Float64(Float64(Float64(t1 * v) / u) / u));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(u, v, t1)
	t_1 = -v / (t1 + u);
	tmp = 0.0;
	if (t1 <= -7.5e-37)
		tmp = t_1;
	elseif (t1 <= 1.9e-10)
		tmp = -(((t1 * v) / u) / u);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[u_, v_, t1_] := Block[{t$95$1 = N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -7.5e-37], t$95$1, If[LessEqual[t1, 1.9e-10], (-N[(N[(N[(t1 * v), $MachinePrecision] / u), $MachinePrecision] / u), $MachinePrecision]), t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{-v}{t1 + u}\\
\mathbf{if}\;t1 \leq -7.5 \cdot 10^{-37}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t1 < -7.5000000000000004e-37 or 1.8999999999999999e-10 < t1

    1. Initial program 56.6%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Step-by-step derivation
      1. associate-/l*59.0%

        \[\leadsto \color{blue}{\left(-t1\right) \cdot \frac{v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      2. distribute-lft-neg-out59.0%

        \[\leadsto \color{blue}{-t1 \cdot \frac{v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      3. distribute-rgt-neg-in59.0%

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

        \[\leadsto t1 \cdot \left(-\color{blue}{\frac{\frac{v}{t1 + u}}{t1 + u}}\right) \]
      5. distribute-neg-frac273.2%

        \[\leadsto t1 \cdot \color{blue}{\frac{\frac{v}{t1 + u}}{-\left(t1 + u\right)}} \]
    3. Simplified73.2%

      \[\leadsto \color{blue}{t1 \cdot \frac{\frac{v}{t1 + u}}{-\left(t1 + u\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-*r/99.9%

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

        \[\leadsto \color{blue}{\frac{-t1 \cdot \frac{v}{t1 + u}}{-\left(-\left(t1 + u\right)\right)}} \]
      3. remove-double-neg99.9%

        \[\leadsto \frac{-t1 \cdot \frac{v}{t1 + u}}{\color{blue}{t1 + u}} \]
    6. Applied egg-rr99.9%

      \[\leadsto \color{blue}{\frac{-t1 \cdot \frac{v}{t1 + u}}{t1 + u}} \]
    7. Taylor expanded in t1 around inf 82.9%

      \[\leadsto \frac{-\color{blue}{v}}{t1 + u} \]

    if -7.5000000000000004e-37 < t1 < 1.8999999999999999e-10

    1. Initial program 86.9%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Step-by-step derivation
      1. associate-/l*87.2%

        \[\leadsto \color{blue}{\left(-t1\right) \cdot \frac{v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      2. distribute-lft-neg-out87.2%

        \[\leadsto \color{blue}{-t1 \cdot \frac{v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      3. distribute-rgt-neg-in87.2%

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

        \[\leadsto t1 \cdot \left(-\color{blue}{\frac{\frac{v}{t1 + u}}{t1 + u}}\right) \]
      5. distribute-neg-frac290.9%

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

      \[\leadsto \color{blue}{t1 \cdot \frac{\frac{v}{t1 + u}}{-\left(t1 + u\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in t1 around 0 79.3%

      \[\leadsto t1 \cdot \frac{\color{blue}{\frac{v}{u}}}{-\left(t1 + u\right)} \]
    6. Step-by-step derivation
      1. distribute-frac-neg279.3%

        \[\leadsto t1 \cdot \color{blue}{\left(-\frac{\frac{v}{u}}{t1 + u}\right)} \]
      2. add-sqr-sqrt42.0%

        \[\leadsto t1 \cdot \left(-\frac{\frac{v}{u}}{\color{blue}{\sqrt{t1 + u} \cdot \sqrt{t1 + u}}}\right) \]
      3. sqrt-unprod60.5%

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

        \[\leadsto t1 \cdot \left(-\frac{\frac{v}{u}}{\sqrt{\color{blue}{\left(-\left(t1 + u\right)\right) \cdot \left(-\left(t1 + u\right)\right)}}}\right) \]
      5. sqrt-unprod19.2%

        \[\leadsto t1 \cdot \left(-\frac{\frac{v}{u}}{\color{blue}{\sqrt{-\left(t1 + u\right)} \cdot \sqrt{-\left(t1 + u\right)}}}\right) \]
      6. add-sqr-sqrt48.0%

        \[\leadsto t1 \cdot \left(-\frac{\frac{v}{u}}{\color{blue}{-\left(t1 + u\right)}}\right) \]
      7. associate-/l/48.0%

        \[\leadsto t1 \cdot \left(-\color{blue}{\frac{v}{\left(-\left(t1 + u\right)\right) \cdot u}}\right) \]
      8. add-sqr-sqrt19.2%

        \[\leadsto t1 \cdot \left(-\frac{v}{\color{blue}{\left(\sqrt{-\left(t1 + u\right)} \cdot \sqrt{-\left(t1 + u\right)}\right)} \cdot u}\right) \]
      9. sqrt-unprod60.5%

        \[\leadsto t1 \cdot \left(-\frac{v}{\color{blue}{\sqrt{\left(-\left(t1 + u\right)\right) \cdot \left(-\left(t1 + u\right)\right)}} \cdot u}\right) \]
      10. sqr-neg60.5%

        \[\leadsto t1 \cdot \left(-\frac{v}{\sqrt{\color{blue}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \cdot u}\right) \]
      11. sqrt-unprod41.2%

        \[\leadsto t1 \cdot \left(-\frac{v}{\color{blue}{\left(\sqrt{t1 + u} \cdot \sqrt{t1 + u}\right)} \cdot u}\right) \]
      12. add-sqr-sqrt77.1%

        \[\leadsto t1 \cdot \left(-\frac{v}{\color{blue}{\left(t1 + u\right)} \cdot u}\right) \]
    7. Applied egg-rr77.1%

      \[\leadsto t1 \cdot \color{blue}{\left(-\frac{v}{\left(t1 + u\right) \cdot u}\right)} \]
    8. Step-by-step derivation
      1. distribute-rgt-neg-out77.1%

        \[\leadsto \color{blue}{-t1 \cdot \frac{v}{\left(t1 + u\right) \cdot u}} \]
      2. associate-*r/76.4%

        \[\leadsto -\color{blue}{\frac{t1 \cdot v}{\left(t1 + u\right) \cdot u}} \]
      3. associate-/l/79.6%

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

        \[\leadsto -\color{blue}{\frac{t1 \cdot v}{u} \cdot \frac{1}{t1 + u}} \]
      5. add-sqr-sqrt58.0%

        \[\leadsto -\color{blue}{\left(\sqrt{\frac{t1 \cdot v}{u}} \cdot \sqrt{\frac{t1 \cdot v}{u}}\right)} \cdot \frac{1}{t1 + u} \]
      6. sqrt-unprod64.3%

        \[\leadsto -\color{blue}{\sqrt{\frac{t1 \cdot v}{u} \cdot \frac{t1 \cdot v}{u}}} \cdot \frac{1}{t1 + u} \]
      7. sqr-neg64.3%

        \[\leadsto -\sqrt{\color{blue}{\left(-\frac{t1 \cdot v}{u}\right) \cdot \left(-\frac{t1 \cdot v}{u}\right)}} \cdot \frac{1}{t1 + u} \]
      8. mul-1-neg64.3%

        \[\leadsto -\sqrt{\color{blue}{\left(-1 \cdot \frac{t1 \cdot v}{u}\right)} \cdot \left(-\frac{t1 \cdot v}{u}\right)} \cdot \frac{1}{t1 + u} \]
      9. mul-1-neg64.3%

        \[\leadsto -\sqrt{\left(-1 \cdot \frac{t1 \cdot v}{u}\right) \cdot \color{blue}{\left(-1 \cdot \frac{t1 \cdot v}{u}\right)}} \cdot \frac{1}{t1 + u} \]
      10. sqrt-unprod43.5%

        \[\leadsto -\color{blue}{\left(\sqrt{-1 \cdot \frac{t1 \cdot v}{u}} \cdot \sqrt{-1 \cdot \frac{t1 \cdot v}{u}}\right)} \cdot \frac{1}{t1 + u} \]
      11. add-sqr-sqrt48.2%

        \[\leadsto -\color{blue}{\left(-1 \cdot \frac{t1 \cdot v}{u}\right)} \cdot \frac{1}{t1 + u} \]
      12. mul-1-neg48.2%

        \[\leadsto -\color{blue}{\left(-\frac{t1 \cdot v}{u}\right)} \cdot \frac{1}{t1 + u} \]
      13. distribute-neg-frac48.2%

        \[\leadsto -\color{blue}{\frac{-t1 \cdot v}{u}} \cdot \frac{1}{t1 + u} \]
      14. associate-*l/48.2%

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

      \[\leadsto \color{blue}{-\frac{\frac{t1 \cdot v}{t1 + u}}{u}} \]
    10. Taylor expanded in t1 around 0 82.2%

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

Alternative 5: 57.9% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := -\frac{v}{u}\\ \mathbf{if}\;u \leq -3.1 \cdot 10^{+136}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;u \leq 9.5 \cdot 10^{+157}:\\ \;\;\;\;-1 \cdot \frac{v}{t1}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (u v t1)
 :precision binary64
 (let* ((t_1 (- (/ v u))))
   (if (<= u -3.1e+136) t_1 (if (<= u 9.5e+157) (* -1.0 (/ v t1)) t_1))))
double code(double u, double v, double t1) {
	double t_1 = -(v / u);
	double tmp;
	if (u <= -3.1e+136) {
		tmp = t_1;
	} else if (u <= 9.5e+157) {
		tmp = -1.0 * (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 / u)
    if (u <= (-3.1d+136)) then
        tmp = t_1
    else if (u <= 9.5d+157) then
        tmp = (-1.0d0) * (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 / u);
	double tmp;
	if (u <= -3.1e+136) {
		tmp = t_1;
	} else if (u <= 9.5e+157) {
		tmp = -1.0 * (v / t1);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(u, v, t1):
	t_1 = -(v / u)
	tmp = 0
	if u <= -3.1e+136:
		tmp = t_1
	elif u <= 9.5e+157:
		tmp = -1.0 * (v / t1)
	else:
		tmp = t_1
	return tmp
function code(u, v, t1)
	t_1 = Float64(-Float64(v / u))
	tmp = 0.0
	if (u <= -3.1e+136)
		tmp = t_1;
	elseif (u <= 9.5e+157)
		tmp = Float64(-1.0 * Float64(v / t1));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(u, v, t1)
	t_1 = -(v / u);
	tmp = 0.0;
	if (u <= -3.1e+136)
		tmp = t_1;
	elseif (u <= 9.5e+157)
		tmp = -1.0 * (v / t1);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[u_, v_, t1_] := Block[{t$95$1 = (-N[(v / u), $MachinePrecision])}, If[LessEqual[u, -3.1e+136], t$95$1, If[LessEqual[u, 9.5e+157], N[(-1.0 * N[(v / t1), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

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

\mathbf{elif}\;u \leq 9.5 \cdot 10^{+157}:\\
\;\;\;\;-1 \cdot \frac{v}{t1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if u < -3.09999999999999983e136 or 9.4999999999999996e157 < u

    1. Initial program 74.9%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Step-by-step derivation
      1. associate-/l*75.3%

        \[\leadsto \color{blue}{\left(-t1\right) \cdot \frac{v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      2. distribute-lft-neg-out75.3%

        \[\leadsto \color{blue}{-t1 \cdot \frac{v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      3. distribute-rgt-neg-in75.3%

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

        \[\leadsto t1 \cdot \left(-\color{blue}{\frac{\frac{v}{t1 + u}}{t1 + u}}\right) \]
      5. distribute-neg-frac288.3%

        \[\leadsto t1 \cdot \color{blue}{\frac{\frac{v}{t1 + u}}{-\left(t1 + u\right)}} \]
    3. Simplified88.3%

      \[\leadsto \color{blue}{t1 \cdot \frac{\frac{v}{t1 + u}}{-\left(t1 + u\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in t1 around 0 88.0%

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

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

        \[\leadsto t1 \cdot \color{blue}{\left(-\frac{v}{t1 \cdot u}\right)} \]
      2. distribute-rgt-neg-out48.2%

        \[\leadsto \color{blue}{-t1 \cdot \frac{v}{t1 \cdot u}} \]
      3. associate-/r*47.8%

        \[\leadsto -t1 \cdot \color{blue}{\frac{\frac{v}{t1}}{u}} \]
    8. Applied egg-rr47.8%

      \[\leadsto \color{blue}{-t1 \cdot \frac{\frac{v}{t1}}{u}} \]
    9. Taylor expanded in t1 around 0 45.5%

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

    if -3.09999999999999983e136 < u < 9.4999999999999996e157

    1. Initial program 70.1%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Step-by-step derivation
      1. associate-/l*71.9%

        \[\leadsto \color{blue}{\left(-t1\right) \cdot \frac{v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      2. distribute-lft-neg-out71.9%

        \[\leadsto \color{blue}{-t1 \cdot \frac{v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      3. distribute-rgt-neg-in71.9%

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

        \[\leadsto t1 \cdot \left(-\color{blue}{\frac{\frac{v}{t1 + u}}{t1 + u}}\right) \]
      5. distribute-neg-frac279.1%

        \[\leadsto t1 \cdot \color{blue}{\frac{\frac{v}{t1 + u}}{-\left(t1 + u\right)}} \]
    3. Simplified79.1%

      \[\leadsto \color{blue}{t1 \cdot \frac{\frac{v}{t1 + u}}{-\left(t1 + u\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in t1 around inf 65.4%

      \[\leadsto \color{blue}{-1 \cdot \frac{v}{t1}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 6: 23.1% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t1 \leq -7.7 \cdot 10^{+121}:\\ \;\;\;\;\frac{v}{t1}\\ \mathbf{elif}\;t1 \leq 2.05 \cdot 10^{+62}:\\ \;\;\;\;-\frac{v}{u}\\ \mathbf{else}:\\ \;\;\;\;\frac{v}{t1}\\ \end{array} \end{array} \]
(FPCore (u v t1)
 :precision binary64
 (if (<= t1 -7.7e+121) (/ v t1) (if (<= t1 2.05e+62) (- (/ v u)) (/ v t1))))
double code(double u, double v, double t1) {
	double tmp;
	if (t1 <= -7.7e+121) {
		tmp = v / t1;
	} else if (t1 <= 2.05e+62) {
		tmp = -(v / u);
	} else {
		tmp = v / t1;
	}
	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) :: tmp
    if (t1 <= (-7.7d+121)) then
        tmp = v / t1
    else if (t1 <= 2.05d+62) then
        tmp = -(v / u)
    else
        tmp = v / t1
    end if
    code = tmp
end function
public static double code(double u, double v, double t1) {
	double tmp;
	if (t1 <= -7.7e+121) {
		tmp = v / t1;
	} else if (t1 <= 2.05e+62) {
		tmp = -(v / u);
	} else {
		tmp = v / t1;
	}
	return tmp;
}
def code(u, v, t1):
	tmp = 0
	if t1 <= -7.7e+121:
		tmp = v / t1
	elif t1 <= 2.05e+62:
		tmp = -(v / u)
	else:
		tmp = v / t1
	return tmp
function code(u, v, t1)
	tmp = 0.0
	if (t1 <= -7.7e+121)
		tmp = Float64(v / t1);
	elseif (t1 <= 2.05e+62)
		tmp = Float64(-Float64(v / u));
	else
		tmp = Float64(v / t1);
	end
	return tmp
end
function tmp_2 = code(u, v, t1)
	tmp = 0.0;
	if (t1 <= -7.7e+121)
		tmp = v / t1;
	elseif (t1 <= 2.05e+62)
		tmp = -(v / u);
	else
		tmp = v / t1;
	end
	tmp_2 = tmp;
end
code[u_, v_, t1_] := If[LessEqual[t1, -7.7e+121], N[(v / t1), $MachinePrecision], If[LessEqual[t1, 2.05e+62], (-N[(v / u), $MachinePrecision]), N[(v / t1), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -7.7 \cdot 10^{+121}:\\
\;\;\;\;\frac{v}{t1}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{v}{t1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t1 < -7.70000000000000028e121 or 2.04999999999999992e62 < t1

    1. Initial program 46.5%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Step-by-step derivation
      1. times-frac99.9%

        \[\leadsto \color{blue}{\frac{-t1}{t1 + u} \cdot \frac{v}{t1 + u}} \]
      2. distribute-frac-neg99.9%

        \[\leadsto \color{blue}{\left(-\frac{t1}{t1 + u}\right)} \cdot \frac{v}{t1 + u} \]
      3. distribute-neg-frac299.9%

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

        \[\leadsto \frac{t1}{-\color{blue}{\left(u + t1\right)}} \cdot \frac{v}{t1 + u} \]
      5. distribute-neg-in99.9%

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

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

      \[\leadsto \color{blue}{\frac{t1}{\left(-u\right) - t1} \cdot \frac{v}{t1 + u}} \]
    4. Add Preprocessing
    5. Taylor expanded in t1 around inf 85.7%

      \[\leadsto \color{blue}{\left(\frac{u}{t1} - 1\right)} \cdot \frac{v}{t1 + u} \]
    6. Taylor expanded in u around inf 39.0%

      \[\leadsto \color{blue}{\frac{v}{t1}} \]

    if -7.70000000000000028e121 < t1 < 2.04999999999999992e62

    1. Initial program 85.7%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Step-by-step derivation
      1. associate-/l*86.1%

        \[\leadsto \color{blue}{\left(-t1\right) \cdot \frac{v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      2. distribute-lft-neg-out86.1%

        \[\leadsto \color{blue}{-t1 \cdot \frac{v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      3. distribute-rgt-neg-in86.1%

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

        \[\leadsto t1 \cdot \left(-\color{blue}{\frac{\frac{v}{t1 + u}}{t1 + u}}\right) \]
      5. distribute-neg-frac291.3%

        \[\leadsto t1 \cdot \color{blue}{\frac{\frac{v}{t1 + u}}{-\left(t1 + u\right)}} \]
    3. Simplified91.3%

      \[\leadsto \color{blue}{t1 \cdot \frac{\frac{v}{t1 + u}}{-\left(t1 + u\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in t1 around 0 71.2%

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

      \[\leadsto t1 \cdot \color{blue}{\left(-1 \cdot \frac{v}{t1 \cdot u}\right)} \]
    7. Step-by-step derivation
      1. mul-1-neg26.3%

        \[\leadsto t1 \cdot \color{blue}{\left(-\frac{v}{t1 \cdot u}\right)} \]
      2. distribute-rgt-neg-out26.3%

        \[\leadsto \color{blue}{-t1 \cdot \frac{v}{t1 \cdot u}} \]
      3. associate-/r*26.8%

        \[\leadsto -t1 \cdot \color{blue}{\frac{\frac{v}{t1}}{u}} \]
    8. Applied egg-rr26.8%

      \[\leadsto \color{blue}{-t1 \cdot \frac{\frac{v}{t1}}{u}} \]
    9. Taylor expanded in t1 around 0 26.3%

      \[\leadsto -\color{blue}{\frac{v}{u}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 98.0% accurate, 1.0× speedup?

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

\\
\frac{t1}{\left(-u\right) - t1} \cdot \frac{v}{t1 + u}
\end{array}
Derivation
  1. Initial program 71.6%

    \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
  2. Step-by-step derivation
    1. times-frac97.8%

      \[\leadsto \color{blue}{\frac{-t1}{t1 + u} \cdot \frac{v}{t1 + u}} \]
    2. distribute-frac-neg97.8%

      \[\leadsto \color{blue}{\left(-\frac{t1}{t1 + u}\right)} \cdot \frac{v}{t1 + u} \]
    3. distribute-neg-frac297.8%

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

      \[\leadsto \frac{t1}{-\color{blue}{\left(u + t1\right)}} \cdot \frac{v}{t1 + u} \]
    5. distribute-neg-in97.8%

      \[\leadsto \frac{t1}{\color{blue}{\left(-u\right) + \left(-t1\right)}} \cdot \frac{v}{t1 + u} \]
    6. unsub-neg97.8%

      \[\leadsto \frac{t1}{\color{blue}{\left(-u\right) - t1}} \cdot \frac{v}{t1 + u} \]
  3. Simplified97.8%

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

Alternative 8: 61.2% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \frac{-v}{t1 + u} \end{array} \]
(FPCore (u v t1) :precision binary64 (/ (- v) (+ t1 u)))
double code(double u, double v, double t1) {
	return -v / (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 = -v / (t1 + u)
end function
public static double code(double u, double v, double t1) {
	return -v / (t1 + u);
}
def code(u, v, t1):
	return -v / (t1 + u)
function code(u, v, t1)
	return Float64(Float64(-v) / Float64(t1 + u))
end
function tmp = code(u, v, t1)
	tmp = -v / (t1 + u);
end
code[u_, v_, t1_] := N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{-v}{t1 + u}
\end{array}
Derivation
  1. Initial program 71.6%

    \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
  2. Step-by-step derivation
    1. associate-/l*73.0%

      \[\leadsto \color{blue}{\left(-t1\right) \cdot \frac{v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
    2. distribute-lft-neg-out73.0%

      \[\leadsto \color{blue}{-t1 \cdot \frac{v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
    3. distribute-rgt-neg-in73.0%

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

      \[\leadsto t1 \cdot \left(-\color{blue}{\frac{\frac{v}{t1 + u}}{t1 + u}}\right) \]
    5. distribute-neg-frac282.0%

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

    \[\leadsto \color{blue}{t1 \cdot \frac{\frac{v}{t1 + u}}{-\left(t1 + u\right)}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. associate-*r/97.4%

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

      \[\leadsto \color{blue}{\frac{-t1 \cdot \frac{v}{t1 + u}}{-\left(-\left(t1 + u\right)\right)}} \]
    3. remove-double-neg97.4%

      \[\leadsto \frac{-t1 \cdot \frac{v}{t1 + u}}{\color{blue}{t1 + u}} \]
  6. Applied egg-rr97.4%

    \[\leadsto \color{blue}{\frac{-t1 \cdot \frac{v}{t1 + u}}{t1 + u}} \]
  7. Taylor expanded in t1 around inf 61.9%

    \[\leadsto \frac{-\color{blue}{v}}{t1 + u} \]
  8. Add Preprocessing

Alternative 9: 14.1% accurate, 4.0× 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(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 71.6%

    \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
  2. Step-by-step derivation
    1. times-frac97.8%

      \[\leadsto \color{blue}{\frac{-t1}{t1 + u} \cdot \frac{v}{t1 + u}} \]
    2. distribute-frac-neg97.8%

      \[\leadsto \color{blue}{\left(-\frac{t1}{t1 + u}\right)} \cdot \frac{v}{t1 + u} \]
    3. distribute-neg-frac297.8%

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

      \[\leadsto \frac{t1}{-\color{blue}{\left(u + t1\right)}} \cdot \frac{v}{t1 + u} \]
    5. distribute-neg-in97.8%

      \[\leadsto \frac{t1}{\color{blue}{\left(-u\right) + \left(-t1\right)}} \cdot \frac{v}{t1 + u} \]
    6. unsub-neg97.8%

      \[\leadsto \frac{t1}{\color{blue}{\left(-u\right) - t1}} \cdot \frac{v}{t1 + u} \]
  3. Simplified97.8%

    \[\leadsto \color{blue}{\frac{t1}{\left(-u\right) - t1} \cdot \frac{v}{t1 + u}} \]
  4. Add Preprocessing
  5. Taylor expanded in t1 around inf 52.4%

    \[\leadsto \color{blue}{\left(\frac{u}{t1} - 1\right)} \cdot \frac{v}{t1 + u} \]
  6. Taylor expanded in u around inf 16.2%

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

Reproduce

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