Rosa's DopplerBench

Percentage Accurate: 72.7% → 98.0%
Time: 8.6s
Alternatives: 12
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 12 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: 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 75.9%

    \[\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. Final simplification97.9%

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

Alternative 2: 79.1% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t1 < -2.1e9 or 4.7999999999999997e42 < t1

    1. Initial program 65.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.1e9 < t1 < 4.7999999999999997e42

    1. Initial program 83.7%

      \[\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. Taylor expanded in t1 around 0 75.7%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t1 \leq -2100000000 \lor \neg \left(t1 \leq 4.8 \cdot 10^{+42}\right):\\ \;\;\;\;\frac{v}{u \cdot -2 - t1}\\ \mathbf{else}:\\ \;\;\;\;\frac{-t1}{u} \cdot \frac{v}{u}\\ \end{array} \]

Alternative 3: 59.4% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;u \leq -3.9 \cdot 10^{+191} \lor \neg \left(u \leq 4.8 \cdot 10^{+217}\right):\\
\;\;\;\;\frac{t1}{t1 \cdot \frac{u}{v}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if u < -3.9e191 or 4.7999999999999996e217 < u

    1. Initial program 82.8%

      \[\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. Step-by-step derivation
      1. *-commutative97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{t1}{\color{blue}{t1 \cdot \frac{u}{v}}} \]
    9. Simplified46.5%

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

    if -3.9e191 < u < 4.7999999999999996e217

    1. Initial program 74.6%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;u \leq -3.9 \cdot 10^{+191} \lor \neg \left(u \leq 4.8 \cdot 10^{+217}\right):\\ \;\;\;\;\frac{t1}{t1 \cdot \frac{u}{v}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-v}{t1}\\ \end{array} \]

Alternative 4: 68.6% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;u \leq -9.5 \cdot 10^{+33} \lor \neg \left(u \leq 1.9 \cdot 10^{+40}\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 -9.5e+33) (not (<= u 1.9e+40)))
   (/ t1 (/ u (/ v u)))
   (/ (- v) t1)))
double code(double u, double v, double t1) {
	double tmp;
	if ((u <= -9.5e+33) || !(u <= 1.9e+40)) {
		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 <= (-9.5d+33)) .or. (.not. (u <= 1.9d+40))) 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 <= -9.5e+33) || !(u <= 1.9e+40)) {
		tmp = t1 / (u / (v / u));
	} else {
		tmp = -v / t1;
	}
	return tmp;
}
def code(u, v, t1):
	tmp = 0
	if (u <= -9.5e+33) or not (u <= 1.9e+40):
		tmp = t1 / (u / (v / u))
	else:
		tmp = -v / t1
	return tmp
function code(u, v, t1)
	tmp = 0.0
	if ((u <= -9.5e+33) || !(u <= 1.9e+40))
		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 <= -9.5e+33) || ~((u <= 1.9e+40)))
		tmp = t1 / (u / (v / u));
	else
		tmp = -v / t1;
	end
	tmp_2 = tmp;
end
code[u_, v_, t1_] := If[Or[LessEqual[u, -9.5e+33], N[Not[LessEqual[u, 1.9e+40]], $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 -9.5 \cdot 10^{+33} \lor \neg \left(u \leq 1.9 \cdot 10^{+40}\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 < -9.5000000000000003e33 or 1.90000000000000002e40 < u

    1. Initial program 81.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.5000000000000003e33 < u < 1.90000000000000002e40

    1. Initial program 71.4%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;u \leq -9.5 \cdot 10^{+33} \lor \neg \left(u \leq 1.9 \cdot 10^{+40}\right):\\ \;\;\;\;\frac{t1}{\frac{u}{\frac{v}{u}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-v}{t1}\\ \end{array} \]

Alternative 5: 95.4% accurate, 1.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{v}{t1 + u}}{\mathsf{fma}\left(-1, \frac{u}{t1}, \color{blue}{-1}\right)} \]
  6. Simplified97.9%

    \[\leadsto \color{blue}{\frac{\frac{v}{t1 + u}}{\mathsf{fma}\left(-1, \frac{u}{t1}, -1\right)}} \]
  7. Taylor expanded in v around 0 95.5%

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

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

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

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

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

      \[\leadsto \frac{\frac{v}{t1 + u}}{0 - \color{blue}{\left(1 + \frac{u}{t1}\right)}} \]
    6. associate--r+97.9%

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

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

    \[\leadsto \color{blue}{\frac{\frac{v}{t1 + u}}{-1 - \frac{u}{t1}}} \]
  10. Step-by-step derivation
    1. expm1-log1p-u84.2%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{v}{t1 + u}}{-1 - \frac{u}{t1}}\right)\right)} \]
    2. expm1-udef52.7%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\frac{v}{t1 + u}}{-1 - \frac{u}{t1}}\right)} - 1} \]
    3. associate-/l/53.4%

      \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{v}{\left(-1 - \frac{u}{t1}\right) \cdot \left(t1 + u\right)}}\right)} - 1 \]
    4. *-commutative53.4%

      \[\leadsto e^{\mathsf{log1p}\left(\frac{v}{\color{blue}{\left(t1 + u\right) \cdot \left(-1 - \frac{u}{t1}\right)}}\right)} - 1 \]
  11. Applied egg-rr53.4%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{v}{\left(t1 + u\right) \cdot \left(-1 - \frac{u}{t1}\right)}\right)} - 1} \]
  12. Step-by-step derivation
    1. expm1-def81.7%

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

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

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

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

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

Alternative 6: 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 75.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{v}{t1 + u}}{\mathsf{fma}\left(-1, \frac{u}{t1}, \color{blue}{-1}\right)} \]
  6. Simplified97.9%

    \[\leadsto \color{blue}{\frac{\frac{v}{t1 + u}}{\mathsf{fma}\left(-1, \frac{u}{t1}, -1\right)}} \]
  7. Taylor expanded in v around 0 95.5%

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

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

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

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

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

      \[\leadsto \frac{\frac{v}{t1 + u}}{0 - \color{blue}{\left(1 + \frac{u}{t1}\right)}} \]
    6. associate--r+97.9%

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

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

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

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

Alternative 7: 58.4% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;u \leq -1.6 \cdot 10^{+191} \lor \neg \left(u \leq 6.2 \cdot 10^{+216}\right):\\
\;\;\;\;\frac{v}{u} \cdot -0.5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if u < -1.6000000000000001e191 or 6.20000000000000007e216 < u

    1. Initial program 82.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.6000000000000001e191 < u < 6.20000000000000007e216

    1. Initial program 74.6%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;u \leq -1.6 \cdot 10^{+191} \lor \neg \left(u \leq 6.2 \cdot 10^{+216}\right):\\ \;\;\;\;\frac{v}{u} \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{-v}{t1}\\ \end{array} \]

Alternative 8: 58.5% accurate, 1.3× speedup?

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

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

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

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


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

    1. Initial program 81.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot v}{u}} \]
      2. associate-/l*41.6%

        \[\leadsto \color{blue}{\frac{-0.5}{\frac{u}{v}}} \]
    9. Simplified41.6%

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

    if -2.1000000000000001e191 < u < 6.50000000000000029e216

    1. Initial program 74.6%

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

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

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

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

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

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

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

    if 6.50000000000000029e216 < u

    1. Initial program 83.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;u \leq -2.1 \cdot 10^{+191}:\\ \;\;\;\;\frac{-0.5}{\frac{u}{v}}\\ \mathbf{elif}\;u \leq 6.5 \cdot 10^{+216}:\\ \;\;\;\;\frac{-v}{t1}\\ \mathbf{else}:\\ \;\;\;\;\frac{v}{u} \cdot -0.5\\ \end{array} \]

Alternative 9: 58.4% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;u \leq -1.9 \cdot 10^{+191} \lor \neg \left(u \leq 1.85 \cdot 10^{+217}\right):\\
\;\;\;\;\frac{v}{u}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if u < -1.8999999999999999e191 or 1.85000000000000005e217 < u

    1. Initial program 82.8%

      \[\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. Taylor expanded in t1 around 0 96.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.8999999999999999e191 < u < 1.85000000000000005e217

    1. Initial program 74.6%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;u \leq -1.9 \cdot 10^{+191} \lor \neg \left(u \leq 1.85 \cdot 10^{+217}\right):\\ \;\;\;\;\frac{v}{u}\\ \mathbf{else}:\\ \;\;\;\;\frac{-v}{t1}\\ \end{array} \]

Alternative 10: 58.4% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;u \leq -1.7 \cdot 10^{+191} \lor \neg \left(u \leq 3 \cdot 10^{+219}\right):\\
\;\;\;\;\frac{-v}{u}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if u < -1.70000000000000004e191 or 2.9999999999999997e219 < u

    1. Initial program 82.8%

      \[\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. Taylor expanded in t1 around 0 96.2%

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

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

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

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

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

    if -1.70000000000000004e191 < u < 2.9999999999999997e219

    1. Initial program 74.6%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;u \leq -1.7 \cdot 10^{+191} \lor \neg \left(u \leq 3 \cdot 10^{+219}\right):\\ \;\;\;\;\frac{-v}{u}\\ \mathbf{else}:\\ \;\;\;\;\frac{-v}{t1}\\ \end{array} \]

Alternative 11: 23.3% accurate, 1.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t1 < -2.9000000000000001e116 or 9.60000000000000011e150 < t1

    1. Initial program 57.0%

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

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

      \[\leadsto \color{blue}{\frac{-t1}{t1 + u} \cdot \frac{v}{t1 + u}} \]
    4. Step-by-step derivation
      1. *-commutative100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.9000000000000001e116 < t1 < 9.60000000000000011e150

    1. Initial program 82.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{t1 \cdot v}{u}}}{t1 - u} \]
      4. *-commutative63.9%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t1 \leq -2.9 \cdot 10^{+116} \lor \neg \left(t1 \leq 9.6 \cdot 10^{+150}\right):\\ \;\;\;\;\frac{v}{t1}\\ \mathbf{else}:\\ \;\;\;\;\frac{v}{u}\\ \end{array} \]

Alternative 12: 14.2% 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 75.9%

    \[\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. Step-by-step derivation
    1. *-commutative97.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{v}{t1}} \]
  7. Final simplification14.0%

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

Reproduce

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