Rosa's DopplerBench

Percentage Accurate: 73.1% → 98.0%
Time: 9.1s
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: 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: 98.0% 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 70.2%

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

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

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

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

Alternative 2: 77.4% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t1 \leq -2.6 \cdot 10^{-153} \lor \neg \left(t1 \leq 3200000000000\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 -2.6e-153) (not (<= t1 3200000000000.0)))
   (/ v (- (* u -2.0) t1))
   (* (/ (- t1) u) (/ v u))))
double code(double u, double v, double t1) {
	double tmp;
	if ((t1 <= -2.6e-153) || !(t1 <= 3200000000000.0)) {
		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 <= (-2.6d-153)) .or. (.not. (t1 <= 3200000000000.0d0))) 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 <= -2.6e-153) || !(t1 <= 3200000000000.0)) {
		tmp = v / ((u * -2.0) - t1);
	} else {
		tmp = (-t1 / u) * (v / u);
	}
	return tmp;
}
def code(u, v, t1):
	tmp = 0
	if (t1 <= -2.6e-153) or not (t1 <= 3200000000000.0):
		tmp = v / ((u * -2.0) - t1)
	else:
		tmp = (-t1 / u) * (v / u)
	return tmp
function code(u, v, t1)
	tmp = 0.0
	if ((t1 <= -2.6e-153) || !(t1 <= 3200000000000.0))
		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 <= -2.6e-153) || ~((t1 <= 3200000000000.0)))
		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, -2.6e-153], N[Not[LessEqual[t1, 3200000000000.0]], $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 -2.6 \cdot 10^{-153} \lor \neg \left(t1 \leq 3200000000000\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 < -2.6000000000000001e-153 or 3.2e12 < t1

    1. Initial program 63.0%

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

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

        \[\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/94.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.6000000000000001e-153 < t1 < 3.2e12

    1. Initial program 82.3%

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

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

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

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

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

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

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

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

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

Alternative 3: 95.1% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;u \leq -3.1 \cdot 10^{+140}:\\
\;\;\;\;\frac{\frac{v}{1 - \frac{u}{t1}}}{u}\\

\mathbf{else}:\\
\;\;\;\;\frac{v}{\left(t1 + u\right) \cdot \left(-1 - \frac{u}{t1}\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if u < -3.1e140

    1. Initial program 62.5%

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{1 \cdot v}{\frac{t1 + u}{-t1}}}}{u} \]
      4. *-un-lft-identity99.9%

        \[\leadsto \frac{\frac{\color{blue}{v}}{\frac{t1 + u}{-t1}}}{u} \]
      5. add-sqr-sqrt47.4%

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

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

        \[\leadsto \frac{\frac{v}{\frac{t1 + u}{\sqrt{\color{blue}{t1 \cdot t1}}}}}{u} \]
      8. sqrt-unprod39.5%

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

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

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

    if -3.1e140 < 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. associate-/r*81.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 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 70.2%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\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.0%

    \[\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.0%

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

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

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

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

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

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

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

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

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

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

Alternative 5: 56.0% accurate, 1.2× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if u < -9.00000000000000078e130

    1. Initial program 64.1%

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

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

        \[\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/60.7%

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

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

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

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

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

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

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

        \[\leadsto \frac{v}{\left(t1 + u\right) \cdot \left(\frac{u}{-t1} + \color{blue}{-1}\right)} \]
    3. Simplified60.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 21.5%

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

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

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

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

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

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

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

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

    if -9.00000000000000078e130 < u

    1. Initial program 70.9%

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

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

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

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

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

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

Alternative 6: 56.0% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;u \leq -1.1 \cdot 10^{+131}:\\
\;\;\;\;\frac{v}{u}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if u < -1.0999999999999999e131

    1. Initial program 64.1%

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

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

        \[\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/60.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{v}{\left(t1 + u\right) \cdot \color{blue}{\frac{1}{\frac{t1}{-u}}}} \]
      2. un-div-inv60.7%

        \[\leadsto \frac{v}{\color{blue}{\frac{t1 + u}{\frac{t1}{-u}}}} \]
      3. add-sqr-sqrt60.7%

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

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

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

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

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

      \[\leadsto \frac{v}{\color{blue}{\frac{t1 + u}{\frac{t1}{u}}}} \]
    10. Taylor expanded in t1 around inf 21.3%

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

    if -1.0999999999999999e131 < u

    1. Initial program 70.9%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;u \leq -1.1 \cdot 10^{+131}:\\ \;\;\;\;\frac{v}{u}\\ \mathbf{else}:\\ \;\;\;\;\frac{-v}{t1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 56.0% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;u \leq -1.15 \cdot 10^{+131}:\\
\;\;\;\;\frac{-v}{u}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if u < -1.14999999999999996e131

    1. Initial program 64.1%

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

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

        \[\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/60.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-v}}{u} \]
    10. Simplified21.5%

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

    if -1.14999999999999996e131 < u

    1. Initial program 70.9%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;u \leq -1.15 \cdot 10^{+131}:\\ \;\;\;\;\frac{-v}{u}\\ \mathbf{else}:\\ \;\;\;\;\frac{-v}{t1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 61.2% 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 70.2%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{v}{\left(t1 + u\right) \cdot \left(\frac{u}{-t1} + \color{blue}{-1}\right)} \]
  3. Simplified94.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 62.6%

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

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

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

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

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

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

Alternative 9: 60.8% accurate, 2.0× speedup?

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1 \cdot v}{\frac{t1 + u}{-t1}}} \cdot \frac{1}{t1 + u} \]
    6. *-un-lft-identity98.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{-1 \cdot \frac{v}{t1 - u}} \]
  7. Step-by-step derivation
    1. mul-1-neg62.4%

      \[\leadsto \color{blue}{-\frac{v}{t1 - u}} \]
    2. distribute-frac-neg62.4%

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

    \[\leadsto \color{blue}{\frac{-v}{t1 - u}} \]
  9. Final simplification62.4%

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

Alternative 10: 17.1% accurate, 4.0× speedup?

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

\\
\frac{v}{u}
\end{array}
Derivation
  1. Initial program 70.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{v}{\left(t1 + u\right) \cdot \color{blue}{\frac{1}{\frac{t1}{-u}}}} \]
    2. un-div-inv41.6%

      \[\leadsto \frac{v}{\color{blue}{\frac{t1 + u}{\frac{t1}{-u}}}} \]
    3. add-sqr-sqrt19.4%

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

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

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

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

      \[\leadsto \frac{v}{\frac{t1 + u}{\frac{t1}{\color{blue}{u}}}} \]
  9. Applied egg-rr24.2%

    \[\leadsto \frac{v}{\color{blue}{\frac{t1 + u}{\frac{t1}{u}}}} \]
  10. Taylor expanded in t1 around inf 12.3%

    \[\leadsto \frac{v}{\color{blue}{u}} \]
  11. Final simplification12.3%

    \[\leadsto \frac{v}{u} \]
  12. Add Preprocessing

Reproduce

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