Rosa's DopplerBench

Percentage Accurate: 73.1% → 97.8%
Time: 8.2s
Alternatives: 10
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 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: 73.1% 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.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{-t1}{t1 + u} \cdot \frac{v}{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[((-t1) / N[(t1 + u), $MachinePrecision]), $MachinePrecision] * N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

      \[\leadsto \color{blue}{\frac{-t1}{t1 + u} \cdot \frac{v}{t1 + u}} \]
  3. Simplified96.6%

    \[\leadsto \color{blue}{\frac{-t1}{t1 + u} \cdot \frac{v}{t1 + u}} \]
  4. Add Preprocessing
  5. Final simplification96.6%

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

Alternative 2: 78.3% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t1 \leq -3.55 \cdot 10^{-124} \lor \neg \left(t1 \leq 2.4 \cdot 10^{-34}\right):\\ \;\;\;\;\frac{v}{u \cdot -2 - t1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{v}{\frac{u}{t1}}}{t1 - u}\\ \end{array} \end{array} \]
(FPCore (u v t1)
 :precision binary64
 (if (or (<= t1 -3.55e-124) (not (<= t1 2.4e-34)))
   (/ v (- (* u -2.0) t1))
   (/ (/ v (/ u t1)) (- t1 u))))
double code(double u, double v, double t1) {
	double tmp;
	if ((t1 <= -3.55e-124) || !(t1 <= 2.4e-34)) {
		tmp = v / ((u * -2.0) - t1);
	} else {
		tmp = (v / (u / t1)) / (t1 - u);
	}
	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 <= (-3.55d-124)) .or. (.not. (t1 <= 2.4d-34))) then
        tmp = v / ((u * (-2.0d0)) - t1)
    else
        tmp = (v / (u / t1)) / (t1 - u)
    end if
    code = tmp
end function
public static double code(double u, double v, double t1) {
	double tmp;
	if ((t1 <= -3.55e-124) || !(t1 <= 2.4e-34)) {
		tmp = v / ((u * -2.0) - t1);
	} else {
		tmp = (v / (u / t1)) / (t1 - u);
	}
	return tmp;
}
def code(u, v, t1):
	tmp = 0
	if (t1 <= -3.55e-124) or not (t1 <= 2.4e-34):
		tmp = v / ((u * -2.0) - t1)
	else:
		tmp = (v / (u / t1)) / (t1 - u)
	return tmp
function code(u, v, t1)
	tmp = 0.0
	if ((t1 <= -3.55e-124) || !(t1 <= 2.4e-34))
		tmp = Float64(v / Float64(Float64(u * -2.0) - t1));
	else
		tmp = Float64(Float64(v / Float64(u / t1)) / Float64(t1 - u));
	end
	return tmp
end
function tmp_2 = code(u, v, t1)
	tmp = 0.0;
	if ((t1 <= -3.55e-124) || ~((t1 <= 2.4e-34)))
		tmp = v / ((u * -2.0) - t1);
	else
		tmp = (v / (u / t1)) / (t1 - u);
	end
	tmp_2 = tmp;
end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -3.55e-124], N[Not[LessEqual[t1, 2.4e-34]], $MachinePrecision]], N[(v / N[(N[(u * -2.0), $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision], N[(N[(v / N[(u / t1), $MachinePrecision]), $MachinePrecision] / N[(t1 - u), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -3.55 \cdot 10^{-124} \lor \neg \left(t1 \leq 2.4 \cdot 10^{-34}\right):\\
\;\;\;\;\frac{v}{u \cdot -2 - t1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t1 < -3.55000000000000019e-124 or 2.39999999999999991e-34 < t1

    1. Initial program 73.5%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{v}{\frac{t1 + u}{-t1}}}}{t1 + u} \]
      4. associate-/l/97.6%

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

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

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

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

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

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

        \[\leadsto \frac{v}{\left(t1 + u\right) \cdot \left(\frac{u}{-t1} + \left(-\color{blue}{1}\right)\right)} \]
      11. metadata-eval97.6%

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

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

      \[\leadsto \frac{v}{\color{blue}{-2 \cdot u + -1 \cdot t1}} \]
    6. Step-by-step derivation
      1. mul-1-neg81.4%

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

        \[\leadsto \frac{v}{\color{blue}{-2 \cdot u - t1}} \]
      3. *-commutative81.4%

        \[\leadsto \frac{v}{\color{blue}{u \cdot -2} - t1} \]
    7. Simplified81.4%

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

    if -3.55000000000000019e-124 < t1 < 2.39999999999999991e-34

    1. Initial program 83.9%

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

        \[\leadsto \color{blue}{\frac{-t1}{t1 + u} \cdot \frac{v}{t1 + u}} \]
    3. Simplified90.1%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot t1}{u}} \cdot \frac{v}{t1 + u} \]
      2. mul-1-neg79.8%

        \[\leadsto \frac{\color{blue}{-t1}}{u} \cdot \frac{v}{t1 + u} \]
    7. Simplified79.8%

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

        \[\leadsto \color{blue}{\frac{\frac{-t1}{u} \cdot v}{t1 + u}} \]
      2. frac-2neg85.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t1 \leq -3.55 \cdot 10^{-124} \lor \neg \left(t1 \leq 2.4 \cdot 10^{-34}\right):\\ \;\;\;\;\frac{v}{u \cdot -2 - t1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{v}{\frac{u}{t1}}}{t1 - u}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 77.6% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t1 \leq -7.3 \cdot 10^{-124} \lor \neg \left(t1 \leq 3.8 \cdot 10^{-35}\right):\\ \;\;\;\;\frac{v}{u \cdot -2 - t1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{t1 \cdot v}{u}}{t1 - u}\\ \end{array} \end{array} \]
(FPCore (u v t1)
 :precision binary64
 (if (or (<= t1 -7.3e-124) (not (<= t1 3.8e-35)))
   (/ v (- (* u -2.0) t1))
   (/ (/ (* t1 v) u) (- t1 u))))
double code(double u, double v, double t1) {
	double tmp;
	if ((t1 <= -7.3e-124) || !(t1 <= 3.8e-35)) {
		tmp = v / ((u * -2.0) - t1);
	} else {
		tmp = ((t1 * v) / u) / (t1 - u);
	}
	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.3d-124)) .or. (.not. (t1 <= 3.8d-35))) then
        tmp = v / ((u * (-2.0d0)) - t1)
    else
        tmp = ((t1 * v) / u) / (t1 - u)
    end if
    code = tmp
end function
public static double code(double u, double v, double t1) {
	double tmp;
	if ((t1 <= -7.3e-124) || !(t1 <= 3.8e-35)) {
		tmp = v / ((u * -2.0) - t1);
	} else {
		tmp = ((t1 * v) / u) / (t1 - u);
	}
	return tmp;
}
def code(u, v, t1):
	tmp = 0
	if (t1 <= -7.3e-124) or not (t1 <= 3.8e-35):
		tmp = v / ((u * -2.0) - t1)
	else:
		tmp = ((t1 * v) / u) / (t1 - u)
	return tmp
function code(u, v, t1)
	tmp = 0.0
	if ((t1 <= -7.3e-124) || !(t1 <= 3.8e-35))
		tmp = Float64(v / Float64(Float64(u * -2.0) - t1));
	else
		tmp = Float64(Float64(Float64(t1 * v) / u) / Float64(t1 - u));
	end
	return tmp
end
function tmp_2 = code(u, v, t1)
	tmp = 0.0;
	if ((t1 <= -7.3e-124) || ~((t1 <= 3.8e-35)))
		tmp = v / ((u * -2.0) - t1);
	else
		tmp = ((t1 * v) / u) / (t1 - u);
	end
	tmp_2 = tmp;
end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -7.3e-124], N[Not[LessEqual[t1, 3.8e-35]], $MachinePrecision]], N[(v / N[(N[(u * -2.0), $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t1 * v), $MachinePrecision] / u), $MachinePrecision] / N[(t1 - u), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -7.3 \cdot 10^{-124} \lor \neg \left(t1 \leq 3.8 \cdot 10^{-35}\right):\\
\;\;\;\;\frac{v}{u \cdot -2 - t1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t1 < -7.3e-124 or 3.8000000000000001e-35 < t1

    1. Initial program 73.5%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{v}{\frac{t1 + u}{-t1}}}}{t1 + u} \]
      4. associate-/l/97.6%

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

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

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

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

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

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

        \[\leadsto \frac{v}{\left(t1 + u\right) \cdot \left(\frac{u}{-t1} + \left(-\color{blue}{1}\right)\right)} \]
      11. metadata-eval97.6%

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

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

      \[\leadsto \frac{v}{\color{blue}{-2 \cdot u + -1 \cdot t1}} \]
    6. Step-by-step derivation
      1. mul-1-neg81.4%

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

        \[\leadsto \frac{v}{\color{blue}{-2 \cdot u - t1}} \]
      3. *-commutative81.4%

        \[\leadsto \frac{v}{\color{blue}{u \cdot -2} - t1} \]
    7. Simplified81.4%

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

    if -7.3e-124 < t1 < 3.8000000000000001e-35

    1. Initial program 83.9%

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

        \[\leadsto \color{blue}{\frac{-t1}{t1 + u} \cdot \frac{v}{t1 + u}} \]
    3. Simplified90.1%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot t1}{u}} \cdot \frac{v}{t1 + u} \]
      2. mul-1-neg79.8%

        \[\leadsto \frac{\color{blue}{-t1}}{u} \cdot \frac{v}{t1 + u} \]
    7. Simplified79.8%

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

        \[\leadsto \color{blue}{\frac{\frac{-t1}{u} \cdot v}{t1 + u}} \]
      2. frac-2neg85.1%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t1 \leq -7.3 \cdot 10^{-124} \lor \neg \left(t1 \leq 3.8 \cdot 10^{-35}\right):\\ \;\;\;\;\frac{v}{u \cdot -2 - t1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{t1 \cdot v}{u}}{t1 - u}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 79.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t1 \leq -4.1 \cdot 10^{-110} \lor \neg \left(t1 \leq 4.6 \cdot 10^{-42}\right):\\ \;\;\;\;\frac{v}{u \cdot -2 - t1}\\ \mathbf{else}:\\ \;\;\;\;\frac{-t1}{u} \cdot \frac{v}{u}\\ \end{array} \end{array} \]
(FPCore (u v t1)
 :precision binary64
 (if (or (<= t1 -4.1e-110) (not (<= t1 4.6e-42)))
   (/ v (- (* u -2.0) t1))
   (* (/ (- t1) u) (/ v u))))
double code(double u, double v, double t1) {
	double tmp;
	if ((t1 <= -4.1e-110) || !(t1 <= 4.6e-42)) {
		tmp = v / ((u * -2.0) - t1);
	} else {
		tmp = (-t1 / u) * (v / u);
	}
	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 <= (-4.1d-110)) .or. (.not. (t1 <= 4.6d-42))) then
        tmp = v / ((u * (-2.0d0)) - t1)
    else
        tmp = (-t1 / u) * (v / u)
    end if
    code = tmp
end function
public static double code(double u, double v, double t1) {
	double tmp;
	if ((t1 <= -4.1e-110) || !(t1 <= 4.6e-42)) {
		tmp = v / ((u * -2.0) - t1);
	} else {
		tmp = (-t1 / u) * (v / u);
	}
	return tmp;
}
def code(u, v, t1):
	tmp = 0
	if (t1 <= -4.1e-110) or not (t1 <= 4.6e-42):
		tmp = v / ((u * -2.0) - t1)
	else:
		tmp = (-t1 / u) * (v / u)
	return tmp
function code(u, v, t1)
	tmp = 0.0
	if ((t1 <= -4.1e-110) || !(t1 <= 4.6e-42))
		tmp = Float64(v / Float64(Float64(u * -2.0) - t1));
	else
		tmp = Float64(Float64(Float64(-t1) / u) * Float64(v / u));
	end
	return tmp
end
function tmp_2 = code(u, v, t1)
	tmp = 0.0;
	if ((t1 <= -4.1e-110) || ~((t1 <= 4.6e-42)))
		tmp = v / ((u * -2.0) - t1);
	else
		tmp = (-t1 / u) * (v / u);
	end
	tmp_2 = tmp;
end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -4.1e-110], N[Not[LessEqual[t1, 4.6e-42]], $MachinePrecision]], N[(v / N[(N[(u * -2.0), $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision], N[(N[((-t1) / u), $MachinePrecision] * N[(v / u), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -4.1 \cdot 10^{-110} \lor \neg \left(t1 \leq 4.6 \cdot 10^{-42}\right):\\
\;\;\;\;\frac{v}{u \cdot -2 - t1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t1 < -4.09999999999999983e-110 or 4.60000000000000008e-42 < t1

    1. Initial program 73.2%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{v}{\frac{t1 + u}{-t1}}}}{t1 + u} \]
      4. associate-/l/97.6%

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

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

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

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

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

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

        \[\leadsto \frac{v}{\left(t1 + u\right) \cdot \left(\frac{u}{-t1} + \left(-\color{blue}{1}\right)\right)} \]
      11. metadata-eval97.6%

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

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

      \[\leadsto \frac{v}{\color{blue}{-2 \cdot u + -1 \cdot t1}} \]
    6. Step-by-step derivation
      1. mul-1-neg81.1%

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

        \[\leadsto \frac{v}{\color{blue}{-2 \cdot u - t1}} \]
      3. *-commutative81.1%

        \[\leadsto \frac{v}{\color{blue}{u \cdot -2} - t1} \]
    7. Simplified81.1%

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

    if -4.09999999999999983e-110 < t1 < 4.60000000000000008e-42

    1. Initial program 84.3%

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

        \[\leadsto \color{blue}{\frac{-t1}{t1 + u} \cdot \frac{v}{t1 + u}} \]
    3. Simplified90.3%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot t1}{u}} \cdot \frac{v}{t1 + u} \]
      2. mul-1-neg80.3%

        \[\leadsto \frac{\color{blue}{-t1}}{u} \cdot \frac{v}{t1 + u} \]
    7. Simplified80.3%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t1 \leq -4.1 \cdot 10^{-110} \lor \neg \left(t1 \leq 4.6 \cdot 10^{-42}\right):\\ \;\;\;\;\frac{v}{u \cdot -2 - t1}\\ \mathbf{else}:\\ \;\;\;\;\frac{-t1}{u} \cdot \frac{v}{u}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 58.4% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;u \leq -9.5 \cdot 10^{+174}:\\
\;\;\;\;\frac{v \cdot -0.5}{u}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if u < -9.4999999999999992e174

    1. Initial program 85.2%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{v}{\frac{t1 + u}{-t1}}}}{t1 + u} \]
      4. associate-/l/96.9%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{v}{\color{blue}{-2 \cdot u + -1 \cdot t1}} \]
    6. Step-by-step derivation
      1. mul-1-neg52.7%

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

        \[\leadsto \frac{v}{\color{blue}{-2 \cdot u - t1}} \]
      3. *-commutative52.7%

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

      \[\leadsto \frac{v}{\color{blue}{u \cdot -2 - t1}} \]
    8. Taylor expanded in u around inf 45.1%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{v}{u}} \]
    9. Step-by-step derivation
      1. associate-*r/45.1%

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

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

    if -9.4999999999999992e174 < u < 4.8999999999999996e159

    1. Initial program 75.3%

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

        \[\leadsto \color{blue}{\frac{-t1}{t1 + u} \cdot \frac{v}{t1 + u}} \]
    3. Simplified95.5%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot v}{t1}} \]
      2. neg-mul-165.2%

        \[\leadsto \frac{\color{blue}{-v}}{t1} \]
    7. Simplified65.2%

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

    if 4.8999999999999996e159 < u

    1. Initial program 79.7%

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

        \[\leadsto \color{blue}{\frac{-t1}{t1 + u} \cdot \frac{v}{t1 + u}} \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\frac{-t1}{t1 + u} \cdot \frac{v}{t1 + u}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num99.8%

        \[\leadsto \color{blue}{\frac{1}{\frac{t1 + u}{-t1}}} \cdot \frac{v}{t1 + u} \]
      2. frac-times86.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{v}{\frac{\color{blue}{t1 - u}}{-\left(-t1\right)} \cdot \left(t1 + u\right)} \]
      12. remove-double-neg86.6%

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{1 \cdot \left(t1 + u\right)} \cdot v} \]
      3. *-un-lft-identity42.5%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;u \leq -9.5 \cdot 10^{+174}:\\ \;\;\;\;\frac{v \cdot -0.5}{u}\\ \mathbf{elif}\;u \leq 4.9 \cdot 10^{+159}:\\ \;\;\;\;\frac{-v}{t1}\\ \mathbf{else}:\\ \;\;\;\;v \cdot \frac{1}{t1 + u}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 58.2% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;u \leq -4.5 \cdot 10^{+185} \lor \neg \left(u \leq 3.2 \cdot 10^{+204}\right):\\ \;\;\;\;\frac{v}{u}\\ \mathbf{else}:\\ \;\;\;\;\frac{-v}{t1}\\ \end{array} \end{array} \]
(FPCore (u v t1)
 :precision binary64
 (if (or (<= u -4.5e+185) (not (<= u 3.2e+204))) (/ v u) (/ (- v) t1)))
double code(double u, double v, double t1) {
	double tmp;
	if ((u <= -4.5e+185) || !(u <= 3.2e+204)) {
		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 ((u <= (-4.5d+185)) .or. (.not. (u <= 3.2d+204))) 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 ((u <= -4.5e+185) || !(u <= 3.2e+204)) {
		tmp = v / u;
	} else {
		tmp = -v / t1;
	}
	return tmp;
}
def code(u, v, t1):
	tmp = 0
	if (u <= -4.5e+185) or not (u <= 3.2e+204):
		tmp = v / u
	else:
		tmp = -v / t1
	return tmp
function code(u, v, t1)
	tmp = 0.0
	if ((u <= -4.5e+185) || !(u <= 3.2e+204))
		tmp = Float64(v / u);
	else
		tmp = Float64(Float64(-v) / t1);
	end
	return tmp
end
function tmp_2 = code(u, v, t1)
	tmp = 0.0;
	if ((u <= -4.5e+185) || ~((u <= 3.2e+204)))
		tmp = v / u;
	else
		tmp = -v / t1;
	end
	tmp_2 = tmp;
end
code[u_, v_, t1_] := If[Or[LessEqual[u, -4.5e+185], N[Not[LessEqual[u, 3.2e+204]], $MachinePrecision]], N[(v / u), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;u \leq -4.5 \cdot 10^{+185} \lor \neg \left(u \leq 3.2 \cdot 10^{+204}\right):\\
\;\;\;\;\frac{v}{u}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if u < -4.5000000000000002e185 or 3.2e204 < u

    1. Initial program 86.8%

      \[\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}} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{\frac{-t1}{t1 + u} \cdot \frac{v}{t1 + u}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num99.8%

        \[\leadsto \color{blue}{\frac{1}{\frac{t1 + u}{-t1}}} \cdot \frac{v}{t1 + u} \]
      2. frac-times94.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{v}{\frac{\color{blue}{t1 - u}}{-\left(-t1\right)} \cdot \left(t1 + u\right)} \]
      12. remove-double-neg90.6%

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

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

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

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

    if -4.5000000000000002e185 < u < 3.2e204

    1. Initial program 74.7%

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

        \[\leadsto \color{blue}{\frac{-t1}{t1 + u} \cdot \frac{v}{t1 + u}} \]
    3. Simplified95.7%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot v}{t1}} \]
      2. neg-mul-163.6%

        \[\leadsto \frac{\color{blue}{-v}}{t1} \]
    7. Simplified63.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;u \leq -4.5 \cdot 10^{+185} \lor \neg \left(u \leq 3.2 \cdot 10^{+204}\right):\\ \;\;\;\;\frac{v}{u}\\ \mathbf{else}:\\ \;\;\;\;\frac{-v}{t1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 58.3% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;u \leq -5.4 \cdot 10^{+173}:\\
\;\;\;\;\frac{v \cdot -0.5}{u}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if u < -5.4000000000000002e173

    1. Initial program 85.2%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{v}{\frac{t1 + u}{-t1}}}}{t1 + u} \]
      4. associate-/l/96.9%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{v}{\color{blue}{-2 \cdot u + -1 \cdot t1}} \]
    6. Step-by-step derivation
      1. mul-1-neg52.7%

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

        \[\leadsto \frac{v}{\color{blue}{-2 \cdot u - t1}} \]
      3. *-commutative52.7%

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

      \[\leadsto \frac{v}{\color{blue}{u \cdot -2 - t1}} \]
    8. Taylor expanded in u around inf 45.1%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{v}{u}} \]
    9. Step-by-step derivation
      1. associate-*r/45.1%

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

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

    if -5.4000000000000002e173 < u < 3.7e204

    1. Initial program 74.6%

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

        \[\leadsto \color{blue}{\frac{-t1}{t1 + u} \cdot \frac{v}{t1 + u}} \]
    3. Simplified95.7%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot v}{t1}} \]
      2. neg-mul-164.3%

        \[\leadsto \frac{\color{blue}{-v}}{t1} \]
    7. Simplified64.3%

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

    if 3.7e204 < u

    1. Initial program 87.2%

      \[\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}} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{\frac{-t1}{t1 + u} \cdot \frac{v}{t1 + u}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num99.9%

        \[\leadsto \color{blue}{\frac{1}{\frac{t1 + u}{-t1}}} \cdot \frac{v}{t1 + u} \]
      2. frac-times91.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{v}{\frac{\color{blue}{t1 - u}}{-\left(-t1\right)} \cdot \left(t1 + u\right)} \]
      12. remove-double-neg91.6%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;u \leq -5.4 \cdot 10^{+173}:\\ \;\;\;\;\frac{v \cdot -0.5}{u}\\ \mathbf{elif}\;u \leq 3.7 \cdot 10^{+204}:\\ \;\;\;\;\frac{-v}{t1}\\ \mathbf{else}:\\ \;\;\;\;\frac{v}{u}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 23.4% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t1 \leq -8.5 \cdot 10^{+151} \lor \neg \left(t1 \leq 4.6 \cdot 10^{+150}\right):\\ \;\;\;\;\frac{v}{t1}\\ \mathbf{else}:\\ \;\;\;\;\frac{v}{u}\\ \end{array} \end{array} \]
(FPCore (u v t1)
 :precision binary64
 (if (or (<= t1 -8.5e+151) (not (<= t1 4.6e+150))) (/ v t1) (/ v u)))
double code(double u, double v, double t1) {
	double tmp;
	if ((t1 <= -8.5e+151) || !(t1 <= 4.6e+150)) {
		tmp = v / t1;
	} else {
		tmp = v / u;
	}
	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 <= (-8.5d+151)) .or. (.not. (t1 <= 4.6d+150))) then
        tmp = v / t1
    else
        tmp = v / u
    end if
    code = tmp
end function
public static double code(double u, double v, double t1) {
	double tmp;
	if ((t1 <= -8.5e+151) || !(t1 <= 4.6e+150)) {
		tmp = v / t1;
	} else {
		tmp = v / u;
	}
	return tmp;
}
def code(u, v, t1):
	tmp = 0
	if (t1 <= -8.5e+151) or not (t1 <= 4.6e+150):
		tmp = v / t1
	else:
		tmp = v / u
	return tmp
function code(u, v, t1)
	tmp = 0.0
	if ((t1 <= -8.5e+151) || !(t1 <= 4.6e+150))
		tmp = Float64(v / t1);
	else
		tmp = Float64(v / u);
	end
	return tmp
end
function tmp_2 = code(u, v, t1)
	tmp = 0.0;
	if ((t1 <= -8.5e+151) || ~((t1 <= 4.6e+150)))
		tmp = v / t1;
	else
		tmp = v / u;
	end
	tmp_2 = tmp;
end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -8.5e+151], N[Not[LessEqual[t1, 4.6e+150]], $MachinePrecision]], N[(v / t1), $MachinePrecision], N[(v / u), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -8.5 \cdot 10^{+151} \lor \neg \left(t1 \leq 4.6 \cdot 10^{+150}\right):\\
\;\;\;\;\frac{v}{t1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t1 < -8.50000000000000051e151 or 4.60000000000000002e150 < t1

    1. Initial program 46.1%

      \[\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}} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{\frac{-t1}{t1 + u} \cdot \frac{v}{t1 + u}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num99.9%

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

        \[\leadsto \color{blue}{\frac{1 \cdot v}{\frac{t1 + u}{-t1} \cdot \left(t1 + u\right)}} \]
      3. *-un-lft-identity98.4%

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.50000000000000051e151 < t1 < 4.60000000000000002e150

    1. Initial program 87.1%

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

        \[\leadsto \color{blue}{\frac{-t1}{t1 + u} \cdot \frac{v}{t1 + u}} \]
    3. Simplified95.5%

      \[\leadsto \color{blue}{\frac{-t1}{t1 + u} \cdot \frac{v}{t1 + u}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num95.4%

        \[\leadsto \color{blue}{\frac{1}{\frac{t1 + u}{-t1}}} \cdot \frac{v}{t1 + u} \]
      2. frac-times93.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{v}{\frac{\color{blue}{t1 - u}}{-\left(-t1\right)} \cdot \left(t1 + u\right)} \]
      12. remove-double-neg54.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t1 \leq -8.5 \cdot 10^{+151} \lor \neg \left(t1 \leq 4.6 \cdot 10^{+150}\right):\\ \;\;\;\;\frac{v}{t1}\\ \mathbf{else}:\\ \;\;\;\;\frac{v}{u}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 61.8% accurate, 1.7× 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 77.0%

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{v}{\frac{t1 + u}{-t1}}}}{t1 + u} \]
    4. associate-/l/94.8%

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

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

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

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

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

      \[\leadsto \frac{v}{\left(t1 + u\right) \cdot \color{blue}{\left(\frac{u}{-t1} + \left(-\frac{-t1}{-t1}\right)\right)}} \]
    10. *-inverses94.7%

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

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

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

    \[\leadsto \frac{v}{\color{blue}{-2 \cdot u + -1 \cdot t1}} \]
  6. Step-by-step derivation
    1. mul-1-neg61.8%

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

      \[\leadsto \frac{v}{\color{blue}{-2 \cdot u - t1}} \]
    3. *-commutative61.8%

      \[\leadsto \frac{v}{\color{blue}{u \cdot -2} - t1} \]
  7. Simplified61.8%

    \[\leadsto \frac{v}{\color{blue}{u \cdot -2 - t1}} \]
  8. Final simplification61.8%

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

Alternative 10: 14.4% 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 77.0%

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

      \[\leadsto \color{blue}{\frac{-t1}{t1 + u} \cdot \frac{v}{t1 + u}} \]
  3. Simplified96.6%

    \[\leadsto \color{blue}{\frac{-t1}{t1 + u} \cdot \frac{v}{t1 + u}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. clear-num96.5%

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

      \[\leadsto \color{blue}{\frac{1 \cdot v}{\frac{t1 + u}{-t1} \cdot \left(t1 + u\right)}} \]
    3. *-un-lft-identity94.8%

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

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

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

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

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

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

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

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

      \[\leadsto \frac{v}{\frac{\color{blue}{t1 - u}}{-\left(-t1\right)} \cdot \left(t1 + u\right)} \]
    12. remove-double-neg52.5%

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

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

    \[\leadsto \frac{v}{\color{blue}{t1}} \]
  8. Final simplification13.1%

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

Reproduce

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