Rosa's DopplerBench

Percentage Accurate: 72.7% → 97.9%
Time: 9.8s
Alternatives: 10
Speedup: 0.9×

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.7% 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: 97.9% accurate, 0.7× speedup?

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

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

    \[\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-*.f64N/A

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\frac{v}{t1 + u}}{-\frac{t1 + u}{t1}}} \]
  5. Final simplification98.0%

    \[\leadsto \frac{\frac{v}{t1 + u}}{\frac{\left(-t1\right) - u}{t1}} \]
  6. Add Preprocessing

Alternative 2: 88.2% accurate, 0.7× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t1 < -2.6e158 or 6.8e140 < t1

    1. Initial program 28.7%

      \[\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-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{v}{t1 + u}}{\color{blue}{\frac{-1 \cdot t1 - u}{t1}}} \]
    6. Step-by-step derivation
      1. div-subN/A

        \[\leadsto \frac{\frac{v}{t1 + u}}{\color{blue}{\frac{-1 \cdot t1}{t1} - \frac{u}{t1}}} \]
      2. associate-/l*N/A

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

        \[\leadsto \frac{\frac{v}{t1 + u}}{-1 \cdot \color{blue}{1} - \frac{u}{t1}} \]
      4. metadata-evalN/A

        \[\leadsto \frac{\frac{v}{t1 + u}}{\color{blue}{-1} - \frac{u}{t1}} \]
      5. lower--.f64N/A

        \[\leadsto \frac{\frac{v}{t1 + u}}{\color{blue}{-1 - \frac{u}{t1}}} \]
      6. lower-/.f6499.8

        \[\leadsto \frac{\frac{v}{t1 + u}}{-1 - \color{blue}{\frac{u}{t1}}} \]
    7. Applied rewrites99.8%

      \[\leadsto \frac{\frac{v}{t1 + u}}{\color{blue}{-1 - \frac{u}{t1}}} \]
    8. Step-by-step derivation
      1. lift-/.f64N/A

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

        \[\leadsto \frac{\color{blue}{\frac{v}{t1 + u}}}{-1 - \frac{u}{t1}} \]
      3. associate-/l/N/A

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

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

        \[\leadsto \frac{v}{\color{blue}{\left(t1 + u\right) \cdot \left(-1 - \frac{u}{t1}\right)}} \]
      6. lower-*.f6494.1

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

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

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

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

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

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

        \[\leadsto \frac{v}{\color{blue}{u \cdot -2} - t1} \]
      5. lower-*.f6485.8

        \[\leadsto \frac{v}{\color{blue}{u \cdot -2} - t1} \]
    12. Applied rewrites85.8%

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

    if -2.6e158 < t1 < 6.8e140

    1. Initial program 83.9%

      \[\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-/.f6490.7

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

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

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

Alternative 3: 97.9% accurate, 0.8× speedup?

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

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

    \[\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-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{\frac{v}{t1 + u}}{\color{blue}{\frac{-1 \cdot t1 - u}{t1}}} \]
  6. Step-by-step derivation
    1. div-subN/A

      \[\leadsto \frac{\frac{v}{t1 + u}}{\color{blue}{\frac{-1 \cdot t1}{t1} - \frac{u}{t1}}} \]
    2. associate-/l*N/A

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

      \[\leadsto \frac{\frac{v}{t1 + u}}{-1 \cdot \color{blue}{1} - \frac{u}{t1}} \]
    4. metadata-evalN/A

      \[\leadsto \frac{\frac{v}{t1 + u}}{\color{blue}{-1} - \frac{u}{t1}} \]
    5. lower--.f64N/A

      \[\leadsto \frac{\frac{v}{t1 + u}}{\color{blue}{-1 - \frac{u}{t1}}} \]
    6. lower-/.f6498.0

      \[\leadsto \frac{\frac{v}{t1 + u}}{-1 - \color{blue}{\frac{u}{t1}}} \]
  7. Applied rewrites98.0%

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

Alternative 4: 76.9% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
t_1 := \frac{v}{u \cdot -2 - t1}\\
\mathbf{if}\;t1 \leq -7.2 \cdot 10^{-79}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t1 < -7.2000000000000005e-79 or 2.1e-35 < t1

    1. Initial program 61.5%

      \[\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-*.f64N/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{v}{t1 + u}}{-\color{blue}{\frac{t1 + u}{t1}}} \]
    4. Applied rewrites99.9%

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

      \[\leadsto \frac{\frac{v}{t1 + u}}{\color{blue}{\frac{-1 \cdot t1 - u}{t1}}} \]
    6. Step-by-step derivation
      1. div-subN/A

        \[\leadsto \frac{\frac{v}{t1 + u}}{\color{blue}{\frac{-1 \cdot t1}{t1} - \frac{u}{t1}}} \]
      2. associate-/l*N/A

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

        \[\leadsto \frac{\frac{v}{t1 + u}}{-1 \cdot \color{blue}{1} - \frac{u}{t1}} \]
      4. metadata-evalN/A

        \[\leadsto \frac{\frac{v}{t1 + u}}{\color{blue}{-1} - \frac{u}{t1}} \]
      5. lower--.f64N/A

        \[\leadsto \frac{\frac{v}{t1 + u}}{\color{blue}{-1 - \frac{u}{t1}}} \]
      6. lower-/.f6499.9

        \[\leadsto \frac{\frac{v}{t1 + u}}{-1 - \color{blue}{\frac{u}{t1}}} \]
    7. Applied rewrites99.9%

      \[\leadsto \frac{\frac{v}{t1 + u}}{\color{blue}{-1 - \frac{u}{t1}}} \]
    8. Step-by-step derivation
      1. lift-/.f64N/A

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

        \[\leadsto \frac{\color{blue}{\frac{v}{t1 + u}}}{-1 - \frac{u}{t1}} \]
      3. associate-/l/N/A

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

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

        \[\leadsto \frac{v}{\color{blue}{\left(t1 + u\right) \cdot \left(-1 - \frac{u}{t1}\right)}} \]
      6. lower-*.f6494.5

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

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

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

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

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

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

        \[\leadsto \frac{v}{\color{blue}{u \cdot -2} - t1} \]
      5. lower-*.f6479.0

        \[\leadsto \frac{v}{\color{blue}{u \cdot -2} - t1} \]
    12. Applied rewrites79.0%

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

    if -7.2000000000000005e-79 < t1 < 2.1e-35

    1. Initial program 82.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 \frac{\left(\mathsf{neg}\left(t1\right)\right) \cdot v}{\color{blue}{{u}^{2}}} \]
    4. Step-by-step derivation
      1. unpow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-v\right) \cdot \color{blue}{\frac{t1}{u \cdot u}} \]
    7. Applied rewrites79.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t1 \leq -7.2 \cdot 10^{-79}:\\ \;\;\;\;\frac{v}{u \cdot -2 - t1}\\ \mathbf{elif}\;t1 \leq 2.1 \cdot 10^{-35}:\\ \;\;\;\;v \cdot \frac{-t1}{u \cdot u}\\ \mathbf{else}:\\ \;\;\;\;\frac{v}{u \cdot -2 - t1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 76.9% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{v}{u \cdot -2 - t1}\\ \mathbf{if}\;t1 \leq -2.3 \cdot 10^{-80}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t1 \leq 2.1 \cdot 10^{-35}:\\ \;\;\;\;t1 \cdot \frac{v}{u \cdot \left(-u\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (u v t1)
 :precision binary64
 (let* ((t_1 (/ v (- (* u -2.0) t1))))
   (if (<= t1 -2.3e-80)
     t_1
     (if (<= t1 2.1e-35) (* t1 (/ v (* u (- u)))) t_1))))
double code(double u, double v, double t1) {
	double t_1 = v / ((u * -2.0) - t1);
	double tmp;
	if (t1 <= -2.3e-80) {
		tmp = t_1;
	} else if (t1 <= 2.1e-35) {
		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 / ((u * (-2.0d0)) - t1)
    if (t1 <= (-2.3d-80)) then
        tmp = t_1
    else if (t1 <= 2.1d-35) 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 / ((u * -2.0) - t1);
	double tmp;
	if (t1 <= -2.3e-80) {
		tmp = t_1;
	} else if (t1 <= 2.1e-35) {
		tmp = t1 * (v / (u * -u));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(u, v, t1):
	t_1 = v / ((u * -2.0) - t1)
	tmp = 0
	if t1 <= -2.3e-80:
		tmp = t_1
	elif t1 <= 2.1e-35:
		tmp = t1 * (v / (u * -u))
	else:
		tmp = t_1
	return tmp
function code(u, v, t1)
	t_1 = Float64(v / Float64(Float64(u * -2.0) - t1))
	tmp = 0.0
	if (t1 <= -2.3e-80)
		tmp = t_1;
	elseif (t1 <= 2.1e-35)
		tmp = Float64(t1 * Float64(v / Float64(u * Float64(-u))));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(u, v, t1)
	t_1 = v / ((u * -2.0) - t1);
	tmp = 0.0;
	if (t1 <= -2.3e-80)
		tmp = t_1;
	elseif (t1 <= 2.1e-35)
		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[(N[(u * -2.0), $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -2.3e-80], t$95$1, If[LessEqual[t1, 2.1e-35], N[(t1 * N[(v / N[(u * (-u)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{v}{u \cdot -2 - t1}\\
\mathbf{if}\;t1 \leq -2.3 \cdot 10^{-80}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t1 < -2.2999999999999998e-80 or 2.1e-35 < t1

    1. Initial program 61.5%

      \[\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-*.f64N/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{v}{t1 + u}}{-\color{blue}{\frac{t1 + u}{t1}}} \]
    4. Applied rewrites99.9%

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

      \[\leadsto \frac{\frac{v}{t1 + u}}{\color{blue}{\frac{-1 \cdot t1 - u}{t1}}} \]
    6. Step-by-step derivation
      1. div-subN/A

        \[\leadsto \frac{\frac{v}{t1 + u}}{\color{blue}{\frac{-1 \cdot t1}{t1} - \frac{u}{t1}}} \]
      2. associate-/l*N/A

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

        \[\leadsto \frac{\frac{v}{t1 + u}}{-1 \cdot \color{blue}{1} - \frac{u}{t1}} \]
      4. metadata-evalN/A

        \[\leadsto \frac{\frac{v}{t1 + u}}{\color{blue}{-1} - \frac{u}{t1}} \]
      5. lower--.f64N/A

        \[\leadsto \frac{\frac{v}{t1 + u}}{\color{blue}{-1 - \frac{u}{t1}}} \]
      6. lower-/.f6499.9

        \[\leadsto \frac{\frac{v}{t1 + u}}{-1 - \color{blue}{\frac{u}{t1}}} \]
    7. Applied rewrites99.9%

      \[\leadsto \frac{\frac{v}{t1 + u}}{\color{blue}{-1 - \frac{u}{t1}}} \]
    8. Step-by-step derivation
      1. lift-/.f64N/A

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

        \[\leadsto \frac{\color{blue}{\frac{v}{t1 + u}}}{-1 - \frac{u}{t1}} \]
      3. associate-/l/N/A

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

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

        \[\leadsto \frac{v}{\color{blue}{\left(t1 + u\right) \cdot \left(-1 - \frac{u}{t1}\right)}} \]
      6. lower-*.f6494.5

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

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

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

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

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

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

        \[\leadsto \frac{v}{\color{blue}{u \cdot -2} - t1} \]
      5. lower-*.f6479.0

        \[\leadsto \frac{v}{\color{blue}{u \cdot -2} - t1} \]
    12. Applied rewrites79.0%

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

    if -2.2999999999999998e-80 < t1 < 2.1e-35

    1. Initial program 82.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.f6475.0

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

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

Alternative 6: 98.0% accurate, 0.8× speedup?

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

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

    \[\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. lower-/.f6498.0

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

    \[\leadsto \color{blue}{\frac{-v}{t1 + u} \cdot \frac{t1}{t1 + u}} \]
  5. Final simplification98.0%

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

Alternative 7: 94.6% accurate, 0.9× speedup?

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

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

    \[\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-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{v}{\color{blue}{\left(u + t1\right)} \cdot \left(-1 \cdot \frac{u}{t1} - 1\right)} \]
    17. sub-negN/A

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

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

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

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

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

      \[\leadsto \frac{v}{\left(u + t1\right) \cdot \color{blue}{\left(-1 - \frac{u}{t1}\right)}} \]
    23. lower-/.f6495.1

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

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

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

Alternative 8: 58.4% accurate, 1.0× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if u < -2.10000000000000017e153 or 2.00000000000000001e160 < u

    1. Initial program 72.3%

      \[\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. lower-/.f6499.8

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{v}{\color{blue}{\mathsf{neg}\left(u\right)}} \cdot 1 \]
        6. lower-neg.f6435.6

          \[\leadsto \frac{v}{\color{blue}{-u}} \cdot 1 \]
      4. Applied rewrites35.6%

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

      if -2.10000000000000017e153 < u < 2.00000000000000001e160

      1. Initial program 68.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.f6464.0

          \[\leadsto \frac{\color{blue}{-v}}{t1} \]
      5. Applied rewrites64.0%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;u \leq -2.1 \cdot 10^{+153}:\\ \;\;\;\;\frac{-v}{u} \cdot 1\\ \mathbf{elif}\;u \leq 2 \cdot 10^{+160}:\\ \;\;\;\;\frac{v}{-t1}\\ \mathbf{else}:\\ \;\;\;\;\frac{-v}{u} \cdot 1\\ \end{array} \]
    9. Add Preprocessing

    Alternative 9: 61.7% accurate, 1.5× speedup?

    \[\begin{array}{l} \\ \frac{v}{u \cdot -2 - t1} \end{array} \]
    (FPCore (u v t1) :precision binary64 (/ v (- (* u -2.0) t1)))
    double code(double u, double v, double t1) {
    	return v / ((u * -2.0) - 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 / ((u * (-2.0d0)) - t1)
    end function
    
    public static double code(double u, double v, double t1) {
    	return v / ((u * -2.0) - t1);
    }
    
    def code(u, v, t1):
    	return v / ((u * -2.0) - t1)
    
    function code(u, v, t1)
    	return Float64(v / Float64(Float64(u * -2.0) - t1))
    end
    
    function tmp = code(u, v, t1)
    	tmp = v / ((u * -2.0) - t1);
    end
    
    code[u_, v_, t1_] := N[(v / N[(N[(u * -2.0), $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \frac{v}{u \cdot -2 - t1}
    \end{array}
    
    Derivation
    1. Initial program 69.7%

      \[\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-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{v}{t1 + u}}{\color{blue}{\frac{-1 \cdot t1 - u}{t1}}} \]
    6. Step-by-step derivation
      1. div-subN/A

        \[\leadsto \frac{\frac{v}{t1 + u}}{\color{blue}{\frac{-1 \cdot t1}{t1} - \frac{u}{t1}}} \]
      2. associate-/l*N/A

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

        \[\leadsto \frac{\frac{v}{t1 + u}}{-1 \cdot \color{blue}{1} - \frac{u}{t1}} \]
      4. metadata-evalN/A

        \[\leadsto \frac{\frac{v}{t1 + u}}{\color{blue}{-1} - \frac{u}{t1}} \]
      5. lower--.f64N/A

        \[\leadsto \frac{\frac{v}{t1 + u}}{\color{blue}{-1 - \frac{u}{t1}}} \]
      6. lower-/.f6498.0

        \[\leadsto \frac{\frac{v}{t1 + u}}{-1 - \color{blue}{\frac{u}{t1}}} \]
    7. Applied rewrites98.0%

      \[\leadsto \frac{\frac{v}{t1 + u}}{\color{blue}{-1 - \frac{u}{t1}}} \]
    8. Step-by-step derivation
      1. lift-/.f64N/A

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

        \[\leadsto \frac{\color{blue}{\frac{v}{t1 + u}}}{-1 - \frac{u}{t1}} \]
      3. associate-/l/N/A

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

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

        \[\leadsto \frac{v}{\color{blue}{\left(t1 + u\right) \cdot \left(-1 - \frac{u}{t1}\right)}} \]
      6. lower-*.f6495.1

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

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

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

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

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

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

        \[\leadsto \frac{v}{\color{blue}{u \cdot -2} - t1} \]
      5. lower-*.f6460.0

        \[\leadsto \frac{v}{\color{blue}{u \cdot -2} - t1} \]
    12. Applied rewrites60.0%

      \[\leadsto \frac{v}{\color{blue}{u \cdot -2 - t1}} \]
    13. Add Preprocessing

    Alternative 10: 53.6% 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(v / Float64(-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 69.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.f6451.2

        \[\leadsto \frac{\color{blue}{-v}}{t1} \]
    5. Applied rewrites51.2%

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

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

    Reproduce

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