Rosa's DopplerBench

Percentage Accurate: 72.7% → 97.9%
Time: 10.9s
Alternatives: 10
Speedup: 1.1×

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, 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 72.6%

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

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

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

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

Alternative 2: 78.6% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -6.5 \cdot 10^{+72} \lor \neg \left(t1 \leq 1.25 \cdot 10^{-26}\right):\\
\;\;\;\;\frac{v}{u \cdot -2 - t1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t1 < -6.5000000000000001e72 or 1.25000000000000005e-26 < t1

    1. Initial program 55.1%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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 87.7%

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

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

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

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

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

    if -6.5000000000000001e72 < t1 < 1.25000000000000005e-26

    1. Initial program 85.3%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t1 \leq -6.5 \cdot 10^{+72} \lor \neg \left(t1 \leq 1.25 \cdot 10^{-26}\right):\\ \;\;\;\;\frac{v}{u \cdot -2 - t1}\\ \mathbf{else}:\\ \;\;\;\;\frac{v}{u} \cdot \frac{-t1}{u}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 78.4% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -6.5 \cdot 10^{+72} \lor \neg \left(t1 \leq 2.5 \cdot 10^{-25}\right):\\
\;\;\;\;\frac{v}{u \cdot -2 - t1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t1 < -6.5000000000000001e72 or 2.49999999999999981e-25 < t1

    1. Initial program 55.1%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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 87.7%

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

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

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

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

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

    if -6.5000000000000001e72 < t1 < 2.49999999999999981e-25

    1. Initial program 85.3%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{-t1}{u}} \cdot \frac{v}{u} \]
    9. Step-by-step derivation
      1. frac-2neg77.8%

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

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

        \[\leadsto \color{blue}{\frac{t1 \cdot \frac{v}{u}}{-u}} \]
    10. Applied egg-rr79.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t1 \leq -6.5 \cdot 10^{+72} \lor \neg \left(t1 \leq 2.5 \cdot 10^{-25}\right):\\ \;\;\;\;\frac{v}{u \cdot -2 - t1}\\ \mathbf{else}:\\ \;\;\;\;\frac{t1 \cdot \frac{v}{u}}{-u}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 78.8% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -2.45 \cdot 10^{+73} \lor \neg \left(t1 \leq 4.8 \cdot 10^{-25}\right):\\
\;\;\;\;\frac{v}{u \cdot -2 - t1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t1 < -2.45e73 or 4.80000000000000018e-25 < t1

    1. Initial program 55.1%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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 87.7%

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

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

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

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

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

    if -2.45e73 < t1 < 4.80000000000000018e-25

    1. Initial program 85.3%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{-t1}{u}} \cdot \frac{v}{u} \]
    9. Step-by-step derivation
      1. frac-2neg77.8%

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

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

        \[\leadsto \color{blue}{\frac{t1 \cdot \frac{v}{u}}{-u}} \]
    10. Applied egg-rr79.0%

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

      \[\leadsto \frac{\color{blue}{\frac{t1 \cdot v}{u}}}{-u} \]
    12. Step-by-step derivation
      1. associate-*l/79.3%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t1 \leq -2.45 \cdot 10^{+73} \lor \neg \left(t1 \leq 4.8 \cdot 10^{-25}\right):\\ \;\;\;\;\frac{v}{u \cdot -2 - t1}\\ \mathbf{else}:\\ \;\;\;\;\frac{v \cdot \frac{t1}{u}}{-u}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 66.6% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;u \leq -5.5 \cdot 10^{+160} \lor \neg \left(u \leq 3.4 \cdot 10^{+69}\right):\\
\;\;\;\;\frac{t1}{u} \cdot \frac{v}{u}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if u < -5.5e160 or 3.39999999999999986e69 < u

    1. Initial program 74.8%

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-t1}}{u} \cdot \frac{v}{u} \]
    8. Simplified85.0%

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

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

        \[\leadsto \color{blue}{\frac{-t1}{\frac{u}{\frac{v}{u}}}} \]
      3. add-sqr-sqrt55.2%

        \[\leadsto \frac{\color{blue}{\sqrt{-t1} \cdot \sqrt{-t1}}}{\frac{u}{\frac{v}{u}}} \]
      4. sqrt-unprod65.3%

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

        \[\leadsto \frac{\sqrt{\color{blue}{t1 \cdot t1}}}{\frac{u}{\frac{v}{u}}} \]
      6. sqrt-unprod23.4%

        \[\leadsto \frac{\color{blue}{\sqrt{t1} \cdot \sqrt{t1}}}{\frac{u}{\frac{v}{u}}} \]
      7. add-sqr-sqrt64.8%

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

      \[\leadsto \color{blue}{\frac{t1}{\frac{u}{\frac{v}{u}}}} \]
    11. Step-by-step derivation
      1. associate-/r/62.5%

        \[\leadsto \color{blue}{\frac{t1}{u} \cdot \frac{v}{u}} \]
      2. *-commutative62.5%

        \[\leadsto \color{blue}{\frac{v}{u} \cdot \frac{t1}{u}} \]
    12. Applied egg-rr62.5%

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

    if -5.5e160 < u < 3.39999999999999986e69

    1. Initial program 71.5%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-v}}{t1} \]
    7. Simplified66.8%

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

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

Alternative 6: 68.4% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;u \leq -6.8 \cdot 10^{+80} \lor \neg \left(u \leq 5.1 \cdot 10^{+64}\right):\\
\;\;\;\;\frac{t1}{\frac{u}{\frac{v}{u}}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if u < -6.79999999999999984e80 or 5.10000000000000024e64 < u

    1. Initial program 74.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-t1}{\frac{u}{\frac{v}{u}}}} \]
      3. add-sqr-sqrt51.5%

        \[\leadsto \frac{\color{blue}{\sqrt{-t1} \cdot \sqrt{-t1}}}{\frac{u}{\frac{v}{u}}} \]
      4. sqrt-unprod61.6%

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

        \[\leadsto \frac{\sqrt{\color{blue}{t1 \cdot t1}}}{\frac{u}{\frac{v}{u}}} \]
      6. sqrt-unprod26.6%

        \[\leadsto \frac{\color{blue}{\sqrt{t1} \cdot \sqrt{t1}}}{\frac{u}{\frac{v}{u}}} \]
      7. add-sqr-sqrt65.0%

        \[\leadsto \frac{\color{blue}{t1}}{\frac{u}{\frac{v}{u}}} \]
    10. Applied egg-rr65.0%

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

    if -6.79999999999999984e80 < u < 5.10000000000000024e64

    1. Initial program 71.0%

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

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

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

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

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

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

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

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

Alternative 7: 58.2% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;u \leq -6.5 \cdot 10^{+160} \lor \neg \left(u \leq 1.6 \cdot 10^{+142}\right):\\
\;\;\;\;\frac{-v}{u}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if u < -6.4999999999999995e160 or 1.60000000000000003e142 < u

    1. Initial program 71.0%

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-v}}{u} \]
    8. Simplified39.1%

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

    if -6.4999999999999995e160 < u < 1.60000000000000003e142

    1. Initial program 73.1%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-v}}{t1} \]
    7. Simplified62.9%

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

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

Alternative 8: 97.8% accurate, 1.1× 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 72.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\frac{v}{t1 + u}}{-1 - \frac{u}{t1}}} \]
  8. Final simplification97.3%

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

Alternative 9: 53.8% accurate, 3.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(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 72.6%

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

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

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

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

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

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

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

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

Alternative 10: 14.1% accurate, 4.0× speedup?

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

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

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

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

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

      \[\leadsto \frac{-t1}{t1 + u} \cdot \frac{\color{blue}{\sqrt{v} \cdot \sqrt{v}}}{t1 + u} \]
    2. *-un-lft-identity51.4%

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

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

    \[\leadsto \frac{-t1}{t1 + u} \cdot \color{blue}{\left(\frac{\sqrt{v}}{1} \cdot \frac{\sqrt{v}}{t1 + u}\right)} \]
  7. Step-by-step derivation
    1. /-rgt-identity51.4%

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

      \[\leadsto \frac{-t1}{t1 + u} \cdot \color{blue}{\frac{\sqrt{v} \cdot \sqrt{v}}{t1 + u}} \]
    3. add-sqr-sqrt97.9%

      \[\leadsto \frac{-t1}{t1 + u} \cdot \frac{\color{blue}{v}}{t1 + u} \]
    4. clear-num96.9%

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{v}{t1}} \]
  13. Final simplification12.5%

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

Reproduce

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