Rosa's DopplerBench

Percentage Accurate: 72.1% → 98.2%
Time: 13.3s
Alternatives: 10
Speedup: 1.0×

Specification

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

\\
\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 10 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 72.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.2% accurate, 1.0× speedup?

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\frac{-t1}{\frac{t1 + u}{v}}}{t1 + u}} \]
  4. Step-by-step derivation
    1. div-inv96.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 90.2% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := v \cdot \frac{-t1}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\ \mathbf{if}\;t1 \leq -3.4 \cdot 10^{+123}:\\ \;\;\;\;\frac{-v}{t1 + u}\\ \mathbf{elif}\;t1 \leq -4.5 \cdot 10^{-148}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t1 \leq 1.15 \cdot 10^{-202}:\\ \;\;\;\;v \cdot \left(\frac{-1}{u} \cdot \frac{t1}{u}\right)\\ \mathbf{elif}\;t1 \leq 1.05 \cdot 10^{+119}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{v}{u - t1}\\ \end{array} \end{array} \]
(FPCore (u v t1)
 :precision binary64
 (let* ((t_1 (* v (/ (- t1) (* (+ t1 u) (+ t1 u))))))
   (if (<= t1 -3.4e+123)
     (/ (- v) (+ t1 u))
     (if (<= t1 -4.5e-148)
       t_1
       (if (<= t1 1.15e-202)
         (* v (* (/ -1.0 u) (/ t1 u)))
         (if (<= t1 1.05e+119) t_1 (/ v (- u t1))))))))
double code(double u, double v, double t1) {
	double t_1 = v * (-t1 / ((t1 + u) * (t1 + u)));
	double tmp;
	if (t1 <= -3.4e+123) {
		tmp = -v / (t1 + u);
	} else if (t1 <= -4.5e-148) {
		tmp = t_1;
	} else if (t1 <= 1.15e-202) {
		tmp = v * ((-1.0 / u) * (t1 / u));
	} else if (t1 <= 1.05e+119) {
		tmp = t_1;
	} else {
		tmp = v / (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) :: t_1
    real(8) :: tmp
    t_1 = v * (-t1 / ((t1 + u) * (t1 + u)))
    if (t1 <= (-3.4d+123)) then
        tmp = -v / (t1 + u)
    else if (t1 <= (-4.5d-148)) then
        tmp = t_1
    else if (t1 <= 1.15d-202) then
        tmp = v * (((-1.0d0) / u) * (t1 / u))
    else if (t1 <= 1.05d+119) then
        tmp = t_1
    else
        tmp = v / (u - t1)
    end if
    code = tmp
end function
public static double code(double u, double v, double t1) {
	double t_1 = v * (-t1 / ((t1 + u) * (t1 + u)));
	double tmp;
	if (t1 <= -3.4e+123) {
		tmp = -v / (t1 + u);
	} else if (t1 <= -4.5e-148) {
		tmp = t_1;
	} else if (t1 <= 1.15e-202) {
		tmp = v * ((-1.0 / u) * (t1 / u));
	} else if (t1 <= 1.05e+119) {
		tmp = t_1;
	} else {
		tmp = v / (u - t1);
	}
	return tmp;
}
def code(u, v, t1):
	t_1 = v * (-t1 / ((t1 + u) * (t1 + u)))
	tmp = 0
	if t1 <= -3.4e+123:
		tmp = -v / (t1 + u)
	elif t1 <= -4.5e-148:
		tmp = t_1
	elif t1 <= 1.15e-202:
		tmp = v * ((-1.0 / u) * (t1 / u))
	elif t1 <= 1.05e+119:
		tmp = t_1
	else:
		tmp = v / (u - t1)
	return tmp
function code(u, v, t1)
	t_1 = Float64(v * Float64(Float64(-t1) / Float64(Float64(t1 + u) * Float64(t1 + u))))
	tmp = 0.0
	if (t1 <= -3.4e+123)
		tmp = Float64(Float64(-v) / Float64(t1 + u));
	elseif (t1 <= -4.5e-148)
		tmp = t_1;
	elseif (t1 <= 1.15e-202)
		tmp = Float64(v * Float64(Float64(-1.0 / u) * Float64(t1 / u)));
	elseif (t1 <= 1.05e+119)
		tmp = t_1;
	else
		tmp = Float64(v / Float64(u - t1));
	end
	return tmp
end
function tmp_2 = code(u, v, t1)
	t_1 = v * (-t1 / ((t1 + u) * (t1 + u)));
	tmp = 0.0;
	if (t1 <= -3.4e+123)
		tmp = -v / (t1 + u);
	elseif (t1 <= -4.5e-148)
		tmp = t_1;
	elseif (t1 <= 1.15e-202)
		tmp = v * ((-1.0 / u) * (t1 / u));
	elseif (t1 <= 1.05e+119)
		tmp = t_1;
	else
		tmp = v / (u - t1);
	end
	tmp_2 = tmp;
end
code[u_, v_, t1_] := Block[{t$95$1 = N[(v * N[((-t1) / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -3.4e+123], N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, -4.5e-148], t$95$1, If[LessEqual[t1, 1.15e-202], N[(v * N[(N[(-1.0 / u), $MachinePrecision] * N[(t1 / u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 1.05e+119], t$95$1, N[(v / N[(u - t1), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := v \cdot \frac{-t1}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\mathbf{if}\;t1 \leq -3.4 \cdot 10^{+123}:\\
\;\;\;\;\frac{-v}{t1 + u}\\

\mathbf{elif}\;t1 \leq -4.5 \cdot 10^{-148}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;t1 \leq 1.05 \cdot 10^{+119}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t1 < -3.40000000000000001e123

    1. Initial program 39.8%

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

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

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

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

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

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

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

    if -3.40000000000000001e123 < t1 < -4.50000000000000015e-148 or 1.1499999999999999e-202 < t1 < 1.04999999999999991e119

    1. Initial program 84.0%

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

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

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

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

    if -4.50000000000000015e-148 < t1 < 1.1499999999999999e-202

    1. Initial program 75.3%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.04999999999999991e119 < t1

    1. Initial program 35.8%

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{-v}}{t1 + u} \]
    7. Step-by-step derivation
      1. frac-2neg92.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{v}}{u - t1} \]
    10. Simplified93.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t1 \leq -3.4 \cdot 10^{+123}:\\ \;\;\;\;\frac{-v}{t1 + u}\\ \mathbf{elif}\;t1 \leq -4.5 \cdot 10^{-148}:\\ \;\;\;\;v \cdot \frac{-t1}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\ \mathbf{elif}\;t1 \leq 1.15 \cdot 10^{-202}:\\ \;\;\;\;v \cdot \left(\frac{-1}{u} \cdot \frac{t1}{u}\right)\\ \mathbf{elif}\;t1 \leq 1.05 \cdot 10^{+119}:\\ \;\;\;\;v \cdot \frac{-t1}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{v}{u - t1}\\ \end{array} \]

Alternative 3: 76.5% accurate, 1.0× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t1 < -4.2e-33

    1. Initial program 56.8%

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

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

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

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

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

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

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

    if -4.2e-33 < t1 < 3.45e16

    1. Initial program 79.3%

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

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

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

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

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

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

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

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

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

    if 3.45e16 < t1

    1. Initial program 52.4%

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{-v}}{t1 + u} \]
    7. Step-by-step derivation
      1. frac-2neg90.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t1 \leq -4.2 \cdot 10^{-33}:\\ \;\;\;\;\frac{-v}{t1 + u}\\ \mathbf{elif}\;t1 \leq 3.45 \cdot 10^{+16}:\\ \;\;\;\;v \cdot \frac{-t1}{u \cdot u}\\ \mathbf{else}:\\ \;\;\;\;\frac{v}{u - t1}\\ \end{array} \]

Alternative 4: 79.7% accurate, 1.0× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t1 < -1.3499999999999999e-32

    1. Initial program 56.8%

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

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

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

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

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

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

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

    if -1.3499999999999999e-32 < t1 < 5.6e20

    1. Initial program 79.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-v \cdot \color{blue}{t1}}{-u \cdot u} \]
      8. distribute-rgt-neg-out41.5%

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

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

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

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

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

        \[\leadsto \frac{v \cdot \color{blue}{t1}}{-u \cdot u} \]
      14. distribute-rgt-neg-in73.0%

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

      \[\leadsto \color{blue}{\frac{v \cdot t1}{u \cdot \left(-u\right)}} \]
    9. Step-by-step derivation
      1. times-frac83.0%

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

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

    if 5.6e20 < t1

    1. Initial program 52.4%

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{-v}}{t1 + u} \]
    7. Step-by-step derivation
      1. frac-2neg90.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t1 \leq -1.35 \cdot 10^{-32}:\\ \;\;\;\;\frac{-v}{t1 + u}\\ \mathbf{elif}\;t1 \leq 5.6 \cdot 10^{+20}:\\ \;\;\;\;\frac{v}{u} \cdot \frac{t1}{-u}\\ \mathbf{else}:\\ \;\;\;\;\frac{v}{u - t1}\\ \end{array} \]

Alternative 5: 67.1% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;u \leq -2.65 \cdot 10^{+172} \lor \neg \left(u \leq 1.52 \cdot 10^{+66}\right):\\
\;\;\;\;\frac{v}{\frac{u \cdot u}{t1}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if u < -2.65e172 or 1.52000000000000004e66 < u

    1. Initial program 72.9%

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

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

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

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

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

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

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

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

      \[\leadsto v \cdot \color{blue}{\frac{-t1}{u \cdot u}} \]
    7. Step-by-step derivation
      1. clear-num69.8%

        \[\leadsto v \cdot \color{blue}{\frac{1}{\frac{u \cdot u}{-t1}}} \]
      2. un-div-inv69.8%

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

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

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

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

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

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

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

    if -2.65e172 < u < 1.52000000000000004e66

    1. Initial program 64.0%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;u \leq -2.65 \cdot 10^{+172} \lor \neg \left(u \leq 1.52 \cdot 10^{+66}\right):\\ \;\;\;\;\frac{v}{\frac{u \cdot u}{t1}}\\ \mathbf{else}:\\ \;\;\;\;-\frac{v}{t1}\\ \end{array} \]

Alternative 6: 23.6% accurate, 1.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.12 \cdot 10^{+83}:\\
\;\;\;\;\frac{v}{t1}\\

\mathbf{elif}\;t1 \leq 1.05 \cdot 10^{+39}:\\
\;\;\;\;\frac{v}{u}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t1 < -1.12e83 or 1.0499999999999999e39 < t1

    1. Initial program 50.3%

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{-v}}{t1 + u} \]
    7. Step-by-step derivation
      1. clear-num91.7%

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

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

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

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

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

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

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

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

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

    if -1.12e83 < t1 < 1.0499999999999999e39

    1. Initial program 78.4%

      \[\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. associate-/l*94.9%

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

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

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

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

      \[\leadsto \frac{\color{blue}{-v}}{t1 + u} \]
    7. Step-by-step derivation
      1. frac-2neg38.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t1 \leq -1.12 \cdot 10^{+83}:\\ \;\;\;\;\frac{v}{t1}\\ \mathbf{elif}\;t1 \leq 1.05 \cdot 10^{+39}:\\ \;\;\;\;\frac{v}{u}\\ \mathbf{else}:\\ \;\;\;\;\frac{v}{t1}\\ \end{array} \]

Alternative 7: 57.1% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;u \leq 8.2 \cdot 10^{+177}:\\ \;\;\;\;-\frac{v}{t1}\\ \mathbf{else}:\\ \;\;\;\;\frac{v}{u}\\ \end{array} \end{array} \]
(FPCore (u v t1) :precision binary64 (if (<= u 8.2e+177) (- (/ v t1)) (/ v u)))
double code(double u, double v, double t1) {
	double tmp;
	if (u <= 8.2e+177) {
		tmp = -(v / t1);
	} else {
		tmp = v / u;
	}
	return tmp;
}
real(8) function code(u, v, t1)
    real(8), intent (in) :: u
    real(8), intent (in) :: v
    real(8), intent (in) :: t1
    real(8) :: tmp
    if (u <= 8.2d+177) then
        tmp = -(v / t1)
    else
        tmp = v / u
    end if
    code = tmp
end function
public static double code(double u, double v, double t1) {
	double tmp;
	if (u <= 8.2e+177) {
		tmp = -(v / t1);
	} else {
		tmp = v / u;
	}
	return tmp;
}
def code(u, v, t1):
	tmp = 0
	if u <= 8.2e+177:
		tmp = -(v / t1)
	else:
		tmp = v / u
	return tmp
function code(u, v, t1)
	tmp = 0.0
	if (u <= 8.2e+177)
		tmp = Float64(-Float64(v / t1));
	else
		tmp = Float64(v / u);
	end
	return tmp
end
function tmp_2 = code(u, v, t1)
	tmp = 0.0;
	if (u <= 8.2e+177)
		tmp = -(v / t1);
	else
		tmp = v / u;
	end
	tmp_2 = tmp;
end
code[u_, v_, t1_] := If[LessEqual[u, 8.2e+177], (-N[(v / t1), $MachinePrecision]), N[(v / u), $MachinePrecision]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if u < 8.20000000000000029e177

    1. Initial program 66.5%

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

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

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

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

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

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

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

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

    if 8.20000000000000029e177 < u

    1. Initial program 68.3%

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{-v}}{t1 + u} \]
    7. Step-by-step derivation
      1. frac-2neg44.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;u \leq 8.2 \cdot 10^{+177}:\\ \;\;\;\;-\frac{v}{t1}\\ \mathbf{else}:\\ \;\;\;\;\frac{v}{u}\\ \end{array} \]

Alternative 8: 57.1% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;u \leq 1.16 \cdot 10^{+178}:\\ \;\;\;\;-\frac{v}{t1}\\ \mathbf{else}:\\ \;\;\;\;-\frac{v}{u}\\ \end{array} \end{array} \]
(FPCore (u v t1)
 :precision binary64
 (if (<= u 1.16e+178) (- (/ v t1)) (- (/ v u))))
double code(double u, double v, double t1) {
	double tmp;
	if (u <= 1.16e+178) {
		tmp = -(v / t1);
	} else {
		tmp = -(v / u);
	}
	return tmp;
}
real(8) function code(u, v, t1)
    real(8), intent (in) :: u
    real(8), intent (in) :: v
    real(8), intent (in) :: t1
    real(8) :: tmp
    if (u <= 1.16d+178) then
        tmp = -(v / t1)
    else
        tmp = -(v / u)
    end if
    code = tmp
end function
public static double code(double u, double v, double t1) {
	double tmp;
	if (u <= 1.16e+178) {
		tmp = -(v / t1);
	} else {
		tmp = -(v / u);
	}
	return tmp;
}
def code(u, v, t1):
	tmp = 0
	if u <= 1.16e+178:
		tmp = -(v / t1)
	else:
		tmp = -(v / u)
	return tmp
function code(u, v, t1)
	tmp = 0.0
	if (u <= 1.16e+178)
		tmp = Float64(-Float64(v / t1));
	else
		tmp = Float64(-Float64(v / u));
	end
	return tmp
end
function tmp_2 = code(u, v, t1)
	tmp = 0.0;
	if (u <= 1.16e+178)
		tmp = -(v / t1);
	else
		tmp = -(v / u);
	end
	tmp_2 = tmp;
end
code[u_, v_, t1_] := If[LessEqual[u, 1.16e+178], (-N[(v / t1), $MachinePrecision]), (-N[(v / u), $MachinePrecision])]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if u < 1.16000000000000005e178

    1. Initial program 66.5%

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

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

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

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

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

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

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

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

    if 1.16000000000000005e178 < u

    1. Initial program 68.3%

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-v}}{u} \]
    7. Simplified40.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;u \leq 1.16 \cdot 10^{+178}:\\ \;\;\;\;-\frac{v}{t1}\\ \mathbf{else}:\\ \;\;\;\;-\frac{v}{u}\\ \end{array} \]

Alternative 9: 62.4% accurate, 2.4× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{v \cdot 1}{u - t1}} \]
    3. *-rgt-identity61.5%

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

    \[\leadsto \color{blue}{\frac{v}{u - t1}} \]
  11. Final simplification61.5%

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

Alternative 10: 14.5% 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 66.6%

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

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{-v}}{t1 + u} \]
  7. Step-by-step derivation
    1. clear-num61.2%

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

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

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

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

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

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

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

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

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

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

Reproduce

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