(y1 * x2 - y2 * x1) / (x2 - x1)

Percentage Accurate: 76.5% → 96.2%
Time: 5.9s
Alternatives: 10
Speedup: 0.6×

Specification

?
\[\left(\left(\left(0 \leq y1 \land y1 \leq 1.79 \cdot 10^{+308}\right) \land \left(0 \leq x2 \land x2 \leq 1.79 \cdot 10^{+308}\right)\right) \land \left(0 \leq y2 \land y2 \leq 1.79 \cdot 10^{+308}\right)\right) \land \left(0 \leq x1 \land x1 \leq 1.79 \cdot 10^{+308}\right)\]
\[\begin{array}{l} \\ \frac{y1 \cdot x2 - y2 \cdot x1}{x2 - x1} \end{array} \]
(FPCore (y1 x2 y2 x1)
 :precision binary64
 (/ (- (* y1 x2) (* y2 x1)) (- x2 x1)))
double code(double y1, double x2, double y2, double x1) {
	return ((y1 * x2) - (y2 * x1)) / (x2 - x1);
}
real(8) function code(y1, x2, y2, x1)
    real(8), intent (in) :: y1
    real(8), intent (in) :: x2
    real(8), intent (in) :: y2
    real(8), intent (in) :: x1
    code = ((y1 * x2) - (y2 * x1)) / (x2 - x1)
end function
public static double code(double y1, double x2, double y2, double x1) {
	return ((y1 * x2) - (y2 * x1)) / (x2 - x1);
}
def code(y1, x2, y2, x1):
	return ((y1 * x2) - (y2 * x1)) / (x2 - x1)
function code(y1, x2, y2, x1)
	return Float64(Float64(Float64(y1 * x2) - Float64(y2 * x1)) / Float64(x2 - x1))
end
function tmp = code(y1, x2, y2, x1)
	tmp = ((y1 * x2) - (y2 * x1)) / (x2 - x1);
end
code[y1_, x2_, y2_, x1_] := N[(N[(N[(y1 * x2), $MachinePrecision] - N[(y2 * x1), $MachinePrecision]), $MachinePrecision] / N[(x2 - x1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{y1 \cdot x2 - y2 \cdot x1}{x2 - x1}
\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: 76.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{y1 \cdot x2 - y2 \cdot x1}{x2 - x1} \end{array} \]
(FPCore (y1 x2 y2 x1)
 :precision binary64
 (/ (- (* y1 x2) (* y2 x1)) (- x2 x1)))
double code(double y1, double x2, double y2, double x1) {
	return ((y1 * x2) - (y2 * x1)) / (x2 - x1);
}
real(8) function code(y1, x2, y2, x1)
    real(8), intent (in) :: y1
    real(8), intent (in) :: x2
    real(8), intent (in) :: y2
    real(8), intent (in) :: x1
    code = ((y1 * x2) - (y2 * x1)) / (x2 - x1)
end function
public static double code(double y1, double x2, double y2, double x1) {
	return ((y1 * x2) - (y2 * x1)) / (x2 - x1);
}
def code(y1, x2, y2, x1):
	return ((y1 * x2) - (y2 * x1)) / (x2 - x1)
function code(y1, x2, y2, x1)
	return Float64(Float64(Float64(y1 * x2) - Float64(y2 * x1)) / Float64(x2 - x1))
end
function tmp = code(y1, x2, y2, x1)
	tmp = ((y1 * x2) - (y2 * x1)) / (x2 - x1);
end
code[y1_, x2_, y2_, x1_] := N[(N[(N[(y1 * x2), $MachinePrecision] - N[(y2 * x1), $MachinePrecision]), $MachinePrecision] / N[(x2 - x1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{y1 \cdot x2 - y2 \cdot x1}{x2 - x1}
\end{array}

Alternative 1: 96.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x2}{x2 - x1}\\ \mathbf{if}\;y2 \leq 1.8 \cdot 10^{-141}:\\ \;\;\;\;\mathsf{fma}\left(t\_0, y1, \frac{x1 \cdot y2}{x1 - x2}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{t\_0}{y2}, y1, \frac{x1}{x1 - x2}\right) \cdot y2\\ \end{array} \end{array} \]
(FPCore (y1 x2 y2 x1)
 :precision binary64
 (let* ((t_0 (/ x2 (- x2 x1))))
   (if (<= y2 1.8e-141)
     (fma t_0 y1 (/ (* x1 y2) (- x1 x2)))
     (* (fma (/ t_0 y2) y1 (/ x1 (- x1 x2))) y2))))
double code(double y1, double x2, double y2, double x1) {
	double t_0 = x2 / (x2 - x1);
	double tmp;
	if (y2 <= 1.8e-141) {
		tmp = fma(t_0, y1, ((x1 * y2) / (x1 - x2)));
	} else {
		tmp = fma((t_0 / y2), y1, (x1 / (x1 - x2))) * y2;
	}
	return tmp;
}
function code(y1, x2, y2, x1)
	t_0 = Float64(x2 / Float64(x2 - x1))
	tmp = 0.0
	if (y2 <= 1.8e-141)
		tmp = fma(t_0, y1, Float64(Float64(x1 * y2) / Float64(x1 - x2)));
	else
		tmp = Float64(fma(Float64(t_0 / y2), y1, Float64(x1 / Float64(x1 - x2))) * y2);
	end
	return tmp
end
code[y1_, x2_, y2_, x1_] := Block[{t$95$0 = N[(x2 / N[(x2 - x1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y2, 1.8e-141], N[(t$95$0 * y1 + N[(N[(x1 * y2), $MachinePrecision] / N[(x1 - x2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$0 / y2), $MachinePrecision] * y1 + N[(x1 / N[(x1 - x2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y2), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{x2}{x2 - x1}\\
\mathbf{if}\;y2 \leq 1.8 \cdot 10^{-141}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, y1, \frac{x1 \cdot y2}{x1 - x2}\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t\_0}{y2}, y1, \frac{x1}{x1 - x2}\right) \cdot y2\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y2 < 1.80000000000000007e-141

    1. Initial program 87.2%

      \[\frac{y1 \cdot x2 - y2 \cdot x1}{x2 - x1} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{y1 \cdot x2 - y2 \cdot x1}{x2 - x1}} \]
      2. lift--.f64N/A

        \[\leadsto \frac{\color{blue}{y1 \cdot x2 - y2 \cdot x1}}{x2 - x1} \]
      3. div-subN/A

        \[\leadsto \color{blue}{\frac{y1 \cdot x2}{x2 - x1} - \frac{y2 \cdot x1}{x2 - x1}} \]
      4. sub-negN/A

        \[\leadsto \color{blue}{\frac{y1 \cdot x2}{x2 - x1} + \left(\mathsf{neg}\left(\frac{y2 \cdot x1}{x2 - x1}\right)\right)} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{y1 \cdot x2}}{x2 - x1} + \left(\mathsf{neg}\left(\frac{y2 \cdot x1}{x2 - x1}\right)\right) \]
      6. associate-/l*N/A

        \[\leadsto \color{blue}{y1 \cdot \frac{x2}{x2 - x1}} + \left(\mathsf{neg}\left(\frac{y2 \cdot x1}{x2 - x1}\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{x2}{x2 - x1} \cdot y1} + \left(\mathsf{neg}\left(\frac{y2 \cdot x1}{x2 - x1}\right)\right) \]
      8. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \mathsf{neg}\left(\frac{y2 \cdot x1}{x2 - x1}\right)\right)} \]
      9. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{x2}{x2 - x1}}, y1, \mathsf{neg}\left(\frac{y2 \cdot x1}{x2 - x1}\right)\right) \]
      10. distribute-neg-frac2N/A

        \[\leadsto \mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \color{blue}{\frac{y2 \cdot x1}{\mathsf{neg}\left(\left(x2 - x1\right)\right)}}\right) \]
      11. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \color{blue}{\frac{y2 \cdot x1}{\mathsf{neg}\left(\left(x2 - x1\right)\right)}}\right) \]
      12. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \frac{\color{blue}{y2 \cdot x1}}{\mathsf{neg}\left(\left(x2 - x1\right)\right)}\right) \]
      13. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \frac{\color{blue}{x1 \cdot y2}}{\mathsf{neg}\left(\left(x2 - x1\right)\right)}\right) \]
      14. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \frac{\color{blue}{x1 \cdot y2}}{\mathsf{neg}\left(\left(x2 - x1\right)\right)}\right) \]
      15. neg-sub0N/A

        \[\leadsto \mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \frac{x1 \cdot y2}{\color{blue}{0 - \left(x2 - x1\right)}}\right) \]
      16. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \frac{x1 \cdot y2}{0 - \color{blue}{\left(x2 - x1\right)}}\right) \]
      17. sub-negN/A

        \[\leadsto \mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \frac{x1 \cdot y2}{0 - \color{blue}{\left(x2 + \left(\mathsf{neg}\left(x1\right)\right)\right)}}\right) \]
      18. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \frac{x1 \cdot y2}{0 - \color{blue}{\left(\left(\mathsf{neg}\left(x1\right)\right) + x2\right)}}\right) \]
      19. associate--r+N/A

        \[\leadsto \mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \frac{x1 \cdot y2}{\color{blue}{\left(0 - \left(\mathsf{neg}\left(x1\right)\right)\right) - x2}}\right) \]
      20. neg-sub0N/A

        \[\leadsto \mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \frac{x1 \cdot y2}{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x1\right)\right)\right)\right)} - x2}\right) \]
      21. remove-double-negN/A

        \[\leadsto \mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \frac{x1 \cdot y2}{\color{blue}{x1} - x2}\right) \]
      22. lower--.f6495.7

        \[\leadsto \mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \frac{x1 \cdot y2}{\color{blue}{x1 - x2}}\right) \]
    4. Applied rewrites95.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \frac{x1 \cdot y2}{x1 - x2}\right)} \]

    if 1.80000000000000007e-141 < y2

    1. Initial program 74.0%

      \[\frac{y1 \cdot x2 - y2 \cdot x1}{x2 - x1} \]
    2. Add Preprocessing
    3. Taylor expanded in y2 around inf

      \[\leadsto \color{blue}{y2 \cdot \left(-1 \cdot \frac{x1}{x2 - x1} + \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right)} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto y2 \cdot \left(\color{blue}{\left(\mathsf{neg}\left(\frac{x1}{x2 - x1}\right)\right)} + \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right) \]
      2. neg-sub0N/A

        \[\leadsto y2 \cdot \left(\color{blue}{\left(0 - \frac{x1}{x2 - x1}\right)} + \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right) \]
      3. associate-+l-N/A

        \[\leadsto y2 \cdot \color{blue}{\left(0 - \left(\frac{x1}{x2 - x1} - \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right)\right)} \]
      4. unsub-negN/A

        \[\leadsto y2 \cdot \left(0 - \color{blue}{\left(\frac{x1}{x2 - x1} + \left(\mathsf{neg}\left(\frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right)\right)\right)}\right) \]
      5. mul-1-negN/A

        \[\leadsto y2 \cdot \left(0 - \left(\frac{x1}{x2 - x1} + \color{blue}{-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}}\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto y2 \cdot \left(0 - \color{blue}{\left(-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)} + \frac{x1}{x2 - x1}\right)}\right) \]
      7. neg-sub0N/A

        \[\leadsto y2 \cdot \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)} + \frac{x1}{x2 - x1}\right)\right)\right)} \]
      8. *-commutativeN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)} + \frac{x1}{x2 - x1}\right)\right)\right) \cdot y2} \]
      9. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)} + \frac{x1}{x2 - x1}\right)\right)\right) \cdot y2} \]
    5. Applied rewrites97.5%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\frac{x2}{x2 - x1}}{y2}, y1, \frac{x1}{x1 - x2}\right) \cdot y2} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification96.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y2 \leq 1.8 \cdot 10^{-141}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \frac{x1 \cdot y2}{x1 - x2}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\frac{x2}{x2 - x1}}{y2}, y1, \frac{x1}{x1 - x2}\right) \cdot y2\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 86.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{y1 \cdot x2 - y2 \cdot x1}{x2 - x1}\\ \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;\frac{-y2}{x2} \cdot x1\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+299}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x1}{x1 - x2} \cdot y2\\ \end{array} \end{array} \]
(FPCore (y1 x2 y2 x1)
 :precision binary64
 (let* ((t_0 (/ (- (* y1 x2) (* y2 x1)) (- x2 x1))))
   (if (<= t_0 (- INFINITY))
     (* (/ (- y2) x2) x1)
     (if (<= t_0 2e+299) t_0 (* (/ x1 (- x1 x2)) y2)))))
double code(double y1, double x2, double y2, double x1) {
	double t_0 = ((y1 * x2) - (y2 * x1)) / (x2 - x1);
	double tmp;
	if (t_0 <= -((double) INFINITY)) {
		tmp = (-y2 / x2) * x1;
	} else if (t_0 <= 2e+299) {
		tmp = t_0;
	} else {
		tmp = (x1 / (x1 - x2)) * y2;
	}
	return tmp;
}
public static double code(double y1, double x2, double y2, double x1) {
	double t_0 = ((y1 * x2) - (y2 * x1)) / (x2 - x1);
	double tmp;
	if (t_0 <= -Double.POSITIVE_INFINITY) {
		tmp = (-y2 / x2) * x1;
	} else if (t_0 <= 2e+299) {
		tmp = t_0;
	} else {
		tmp = (x1 / (x1 - x2)) * y2;
	}
	return tmp;
}
def code(y1, x2, y2, x1):
	t_0 = ((y1 * x2) - (y2 * x1)) / (x2 - x1)
	tmp = 0
	if t_0 <= -math.inf:
		tmp = (-y2 / x2) * x1
	elif t_0 <= 2e+299:
		tmp = t_0
	else:
		tmp = (x1 / (x1 - x2)) * y2
	return tmp
function code(y1, x2, y2, x1)
	t_0 = Float64(Float64(Float64(y1 * x2) - Float64(y2 * x1)) / Float64(x2 - x1))
	tmp = 0.0
	if (t_0 <= Float64(-Inf))
		tmp = Float64(Float64(Float64(-y2) / x2) * x1);
	elseif (t_0 <= 2e+299)
		tmp = t_0;
	else
		tmp = Float64(Float64(x1 / Float64(x1 - x2)) * y2);
	end
	return tmp
end
function tmp_2 = code(y1, x2, y2, x1)
	t_0 = ((y1 * x2) - (y2 * x1)) / (x2 - x1);
	tmp = 0.0;
	if (t_0 <= -Inf)
		tmp = (-y2 / x2) * x1;
	elseif (t_0 <= 2e+299)
		tmp = t_0;
	else
		tmp = (x1 / (x1 - x2)) * y2;
	end
	tmp_2 = tmp;
end
code[y1_, x2_, y2_, x1_] := Block[{t$95$0 = N[(N[(N[(y1 * x2), $MachinePrecision] - N[(y2 * x1), $MachinePrecision]), $MachinePrecision] / N[(x2 - x1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[((-y2) / x2), $MachinePrecision] * x1), $MachinePrecision], If[LessEqual[t$95$0, 2e+299], t$95$0, N[(N[(x1 / N[(x1 - x2), $MachinePrecision]), $MachinePrecision] * y2), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{y1 \cdot x2 - y2 \cdot x1}{x2 - x1}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\frac{-y2}{x2} \cdot x1\\

\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+299}:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;\frac{x1}{x1 - x2} \cdot y2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (-.f64 (*.f64 y1 x2) (*.f64 y2 x1)) (-.f64 x2 x1)) < -inf.0

    1. Initial program 4.8%

      \[\frac{y1 \cdot x2 - y2 \cdot x1}{x2 - x1} \]
    2. Add Preprocessing
    3. Taylor expanded in y1 around 0

      \[\leadsto \color{blue}{-1 \cdot \frac{x1 \cdot y2}{x2 - x1}} \]
    4. Step-by-step derivation
      1. associate-*l/N/A

        \[\leadsto -1 \cdot \color{blue}{\left(\frac{x1}{x2 - x1} \cdot y2\right)} \]
      2. associate-*l*N/A

        \[\leadsto \color{blue}{\left(-1 \cdot \frac{x1}{x2 - x1}\right) \cdot y2} \]
      3. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(-1 \cdot \frac{x1}{x2 - x1}\right) \cdot y2} \]
      4. mul-1-negN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{x1}{x2 - x1}\right)\right)} \cdot y2 \]
      5. distribute-neg-frac2N/A

        \[\leadsto \color{blue}{\frac{x1}{\mathsf{neg}\left(\left(x2 - x1\right)\right)}} \cdot y2 \]
      6. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{x1}{\mathsf{neg}\left(\left(x2 - x1\right)\right)}} \cdot y2 \]
      7. sub-negN/A

        \[\leadsto \frac{x1}{\mathsf{neg}\left(\color{blue}{\left(x2 + \left(\mathsf{neg}\left(x1\right)\right)\right)}\right)} \cdot y2 \]
      8. mul-1-negN/A

        \[\leadsto \frac{x1}{\mathsf{neg}\left(\left(x2 + \color{blue}{-1 \cdot x1}\right)\right)} \cdot y2 \]
      9. +-commutativeN/A

        \[\leadsto \frac{x1}{\mathsf{neg}\left(\color{blue}{\left(-1 \cdot x1 + x2\right)}\right)} \cdot y2 \]
      10. distribute-neg-inN/A

        \[\leadsto \frac{x1}{\color{blue}{\left(\mathsf{neg}\left(-1 \cdot x1\right)\right) + \left(\mathsf{neg}\left(x2\right)\right)}} \cdot y2 \]
      11. mul-1-negN/A

        \[\leadsto \frac{x1}{\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x1\right)\right)}\right)\right) + \left(\mathsf{neg}\left(x2\right)\right)} \cdot y2 \]
      12. remove-double-negN/A

        \[\leadsto \frac{x1}{\color{blue}{x1} + \left(\mathsf{neg}\left(x2\right)\right)} \cdot y2 \]
      13. sub-negN/A

        \[\leadsto \frac{x1}{\color{blue}{x1 - x2}} \cdot y2 \]
      14. lower--.f6455.9

        \[\leadsto \frac{x1}{\color{blue}{x1 - x2}} \cdot y2 \]
    5. Applied rewrites55.9%

      \[\leadsto \color{blue}{\frac{x1}{x1 - x2} \cdot y2} \]
    6. Taylor expanded in x2 around inf

      \[\leadsto -1 \cdot \color{blue}{\frac{x1 \cdot y2}{x2}} \]
    7. Step-by-step derivation
      1. Applied rewrites57.8%

        \[\leadsto \frac{-y2}{x2} \cdot \color{blue}{x1} \]

      if -inf.0 < (/.f64 (-.f64 (*.f64 y1 x2) (*.f64 y2 x1)) (-.f64 x2 x1)) < 2.0000000000000001e299

      1. Initial program 97.6%

        \[\frac{y1 \cdot x2 - y2 \cdot x1}{x2 - x1} \]
      2. Add Preprocessing

      if 2.0000000000000001e299 < (/.f64 (-.f64 (*.f64 y1 x2) (*.f64 y2 x1)) (-.f64 x2 x1))

      1. Initial program 10.1%

        \[\frac{y1 \cdot x2 - y2 \cdot x1}{x2 - x1} \]
      2. Add Preprocessing
      3. Taylor expanded in y1 around 0

        \[\leadsto \color{blue}{-1 \cdot \frac{x1 \cdot y2}{x2 - x1}} \]
      4. Step-by-step derivation
        1. associate-*l/N/A

          \[\leadsto -1 \cdot \color{blue}{\left(\frac{x1}{x2 - x1} \cdot y2\right)} \]
        2. associate-*l*N/A

          \[\leadsto \color{blue}{\left(-1 \cdot \frac{x1}{x2 - x1}\right) \cdot y2} \]
        3. lower-*.f64N/A

          \[\leadsto \color{blue}{\left(-1 \cdot \frac{x1}{x2 - x1}\right) \cdot y2} \]
        4. mul-1-negN/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{x1}{x2 - x1}\right)\right)} \cdot y2 \]
        5. distribute-neg-frac2N/A

          \[\leadsto \color{blue}{\frac{x1}{\mathsf{neg}\left(\left(x2 - x1\right)\right)}} \cdot y2 \]
        6. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{x1}{\mathsf{neg}\left(\left(x2 - x1\right)\right)}} \cdot y2 \]
        7. sub-negN/A

          \[\leadsto \frac{x1}{\mathsf{neg}\left(\color{blue}{\left(x2 + \left(\mathsf{neg}\left(x1\right)\right)\right)}\right)} \cdot y2 \]
        8. mul-1-negN/A

          \[\leadsto \frac{x1}{\mathsf{neg}\left(\left(x2 + \color{blue}{-1 \cdot x1}\right)\right)} \cdot y2 \]
        9. +-commutativeN/A

          \[\leadsto \frac{x1}{\mathsf{neg}\left(\color{blue}{\left(-1 \cdot x1 + x2\right)}\right)} \cdot y2 \]
        10. distribute-neg-inN/A

          \[\leadsto \frac{x1}{\color{blue}{\left(\mathsf{neg}\left(-1 \cdot x1\right)\right) + \left(\mathsf{neg}\left(x2\right)\right)}} \cdot y2 \]
        11. mul-1-negN/A

          \[\leadsto \frac{x1}{\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x1\right)\right)}\right)\right) + \left(\mathsf{neg}\left(x2\right)\right)} \cdot y2 \]
        12. remove-double-negN/A

          \[\leadsto \frac{x1}{\color{blue}{x1} + \left(\mathsf{neg}\left(x2\right)\right)} \cdot y2 \]
        13. sub-negN/A

          \[\leadsto \frac{x1}{\color{blue}{x1 - x2}} \cdot y2 \]
        14. lower--.f6457.3

          \[\leadsto \frac{x1}{\color{blue}{x1 - x2}} \cdot y2 \]
      5. Applied rewrites57.3%

        \[\leadsto \color{blue}{\frac{x1}{x1 - x2} \cdot y2} \]
    8. Recombined 3 regimes into one program.
    9. Final simplification89.0%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y1 \cdot x2 - y2 \cdot x1}{x2 - x1} \leq -\infty:\\ \;\;\;\;\frac{-y2}{x2} \cdot x1\\ \mathbf{elif}\;\frac{y1 \cdot x2 - y2 \cdot x1}{x2 - x1} \leq 2 \cdot 10^{+299}:\\ \;\;\;\;\frac{y1 \cdot x2 - y2 \cdot x1}{x2 - x1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x1}{x1 - x2} \cdot y2\\ \end{array} \]
    10. Add Preprocessing

    Alternative 3: 89.2% accurate, 0.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y2 \leq 2.6 \cdot 10^{+163}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \frac{x1 \cdot y2}{x1 - x2}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x1}{x1 - x2} \cdot y2\\ \end{array} \end{array} \]
    (FPCore (y1 x2 y2 x1)
     :precision binary64
     (if (<= y2 2.6e+163)
       (fma (/ x2 (- x2 x1)) y1 (/ (* x1 y2) (- x1 x2)))
       (* (/ x1 (- x1 x2)) y2)))
    double code(double y1, double x2, double y2, double x1) {
    	double tmp;
    	if (y2 <= 2.6e+163) {
    		tmp = fma((x2 / (x2 - x1)), y1, ((x1 * y2) / (x1 - x2)));
    	} else {
    		tmp = (x1 / (x1 - x2)) * y2;
    	}
    	return tmp;
    }
    
    function code(y1, x2, y2, x1)
    	tmp = 0.0
    	if (y2 <= 2.6e+163)
    		tmp = fma(Float64(x2 / Float64(x2 - x1)), y1, Float64(Float64(x1 * y2) / Float64(x1 - x2)));
    	else
    		tmp = Float64(Float64(x1 / Float64(x1 - x2)) * y2);
    	end
    	return tmp
    end
    
    code[y1_, x2_, y2_, x1_] := If[LessEqual[y2, 2.6e+163], N[(N[(x2 / N[(x2 - x1), $MachinePrecision]), $MachinePrecision] * y1 + N[(N[(x1 * y2), $MachinePrecision] / N[(x1 - x2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x1 / N[(x1 - x2), $MachinePrecision]), $MachinePrecision] * y2), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y2 \leq 2.6 \cdot 10^{+163}:\\
    \;\;\;\;\mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \frac{x1 \cdot y2}{x1 - x2}\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{x1}{x1 - x2} \cdot y2\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y2 < 2.6000000000000002e163

      1. Initial program 85.4%

        \[\frac{y1 \cdot x2 - y2 \cdot x1}{x2 - x1} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \color{blue}{\frac{y1 \cdot x2 - y2 \cdot x1}{x2 - x1}} \]
        2. lift--.f64N/A

          \[\leadsto \frac{\color{blue}{y1 \cdot x2 - y2 \cdot x1}}{x2 - x1} \]
        3. div-subN/A

          \[\leadsto \color{blue}{\frac{y1 \cdot x2}{x2 - x1} - \frac{y2 \cdot x1}{x2 - x1}} \]
        4. sub-negN/A

          \[\leadsto \color{blue}{\frac{y1 \cdot x2}{x2 - x1} + \left(\mathsf{neg}\left(\frac{y2 \cdot x1}{x2 - x1}\right)\right)} \]
        5. lift-*.f64N/A

          \[\leadsto \frac{\color{blue}{y1 \cdot x2}}{x2 - x1} + \left(\mathsf{neg}\left(\frac{y2 \cdot x1}{x2 - x1}\right)\right) \]
        6. associate-/l*N/A

          \[\leadsto \color{blue}{y1 \cdot \frac{x2}{x2 - x1}} + \left(\mathsf{neg}\left(\frac{y2 \cdot x1}{x2 - x1}\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \color{blue}{\frac{x2}{x2 - x1} \cdot y1} + \left(\mathsf{neg}\left(\frac{y2 \cdot x1}{x2 - x1}\right)\right) \]
        8. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \mathsf{neg}\left(\frac{y2 \cdot x1}{x2 - x1}\right)\right)} \]
        9. lower-/.f64N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{x2}{x2 - x1}}, y1, \mathsf{neg}\left(\frac{y2 \cdot x1}{x2 - x1}\right)\right) \]
        10. distribute-neg-frac2N/A

          \[\leadsto \mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \color{blue}{\frac{y2 \cdot x1}{\mathsf{neg}\left(\left(x2 - x1\right)\right)}}\right) \]
        11. lower-/.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \color{blue}{\frac{y2 \cdot x1}{\mathsf{neg}\left(\left(x2 - x1\right)\right)}}\right) \]
        12. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \frac{\color{blue}{y2 \cdot x1}}{\mathsf{neg}\left(\left(x2 - x1\right)\right)}\right) \]
        13. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \frac{\color{blue}{x1 \cdot y2}}{\mathsf{neg}\left(\left(x2 - x1\right)\right)}\right) \]
        14. lower-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \frac{\color{blue}{x1 \cdot y2}}{\mathsf{neg}\left(\left(x2 - x1\right)\right)}\right) \]
        15. neg-sub0N/A

          \[\leadsto \mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \frac{x1 \cdot y2}{\color{blue}{0 - \left(x2 - x1\right)}}\right) \]
        16. lift--.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \frac{x1 \cdot y2}{0 - \color{blue}{\left(x2 - x1\right)}}\right) \]
        17. sub-negN/A

          \[\leadsto \mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \frac{x1 \cdot y2}{0 - \color{blue}{\left(x2 + \left(\mathsf{neg}\left(x1\right)\right)\right)}}\right) \]
        18. +-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \frac{x1 \cdot y2}{0 - \color{blue}{\left(\left(\mathsf{neg}\left(x1\right)\right) + x2\right)}}\right) \]
        19. associate--r+N/A

          \[\leadsto \mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \frac{x1 \cdot y2}{\color{blue}{\left(0 - \left(\mathsf{neg}\left(x1\right)\right)\right) - x2}}\right) \]
        20. neg-sub0N/A

          \[\leadsto \mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \frac{x1 \cdot y2}{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x1\right)\right)\right)\right)} - x2}\right) \]
        21. remove-double-negN/A

          \[\leadsto \mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \frac{x1 \cdot y2}{\color{blue}{x1} - x2}\right) \]
        22. lower--.f6494.2

          \[\leadsto \mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \frac{x1 \cdot y2}{\color{blue}{x1 - x2}}\right) \]
      4. Applied rewrites94.2%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \frac{x1 \cdot y2}{x1 - x2}\right)} \]

      if 2.6000000000000002e163 < y2

      1. Initial program 44.1%

        \[\frac{y1 \cdot x2 - y2 \cdot x1}{x2 - x1} \]
      2. Add Preprocessing
      3. Taylor expanded in y1 around 0

        \[\leadsto \color{blue}{-1 \cdot \frac{x1 \cdot y2}{x2 - x1}} \]
      4. Step-by-step derivation
        1. associate-*l/N/A

          \[\leadsto -1 \cdot \color{blue}{\left(\frac{x1}{x2 - x1} \cdot y2\right)} \]
        2. associate-*l*N/A

          \[\leadsto \color{blue}{\left(-1 \cdot \frac{x1}{x2 - x1}\right) \cdot y2} \]
        3. lower-*.f64N/A

          \[\leadsto \color{blue}{\left(-1 \cdot \frac{x1}{x2 - x1}\right) \cdot y2} \]
        4. mul-1-negN/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{x1}{x2 - x1}\right)\right)} \cdot y2 \]
        5. distribute-neg-frac2N/A

          \[\leadsto \color{blue}{\frac{x1}{\mathsf{neg}\left(\left(x2 - x1\right)\right)}} \cdot y2 \]
        6. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{x1}{\mathsf{neg}\left(\left(x2 - x1\right)\right)}} \cdot y2 \]
        7. sub-negN/A

          \[\leadsto \frac{x1}{\mathsf{neg}\left(\color{blue}{\left(x2 + \left(\mathsf{neg}\left(x1\right)\right)\right)}\right)} \cdot y2 \]
        8. mul-1-negN/A

          \[\leadsto \frac{x1}{\mathsf{neg}\left(\left(x2 + \color{blue}{-1 \cdot x1}\right)\right)} \cdot y2 \]
        9. +-commutativeN/A

          \[\leadsto \frac{x1}{\mathsf{neg}\left(\color{blue}{\left(-1 \cdot x1 + x2\right)}\right)} \cdot y2 \]
        10. distribute-neg-inN/A

          \[\leadsto \frac{x1}{\color{blue}{\left(\mathsf{neg}\left(-1 \cdot x1\right)\right) + \left(\mathsf{neg}\left(x2\right)\right)}} \cdot y2 \]
        11. mul-1-negN/A

          \[\leadsto \frac{x1}{\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x1\right)\right)}\right)\right) + \left(\mathsf{neg}\left(x2\right)\right)} \cdot y2 \]
        12. remove-double-negN/A

          \[\leadsto \frac{x1}{\color{blue}{x1} + \left(\mathsf{neg}\left(x2\right)\right)} \cdot y2 \]
        13. sub-negN/A

          \[\leadsto \frac{x1}{\color{blue}{x1 - x2}} \cdot y2 \]
        14. lower--.f6487.6

          \[\leadsto \frac{x1}{\color{blue}{x1 - x2}} \cdot y2 \]
      5. Applied rewrites87.6%

        \[\leadsto \color{blue}{\frac{x1}{x1 - x2} \cdot y2} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification93.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;y2 \leq 2.6 \cdot 10^{+163}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x2}{x2 - x1}, y1, \frac{x1 \cdot y2}{x1 - x2}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x1}{x1 - x2} \cdot y2\\ \end{array} \]
    5. Add Preprocessing

    Alternative 4: 70.8% accurate, 1.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x1 \leq 0.108:\\ \;\;\;\;\mathsf{fma}\left(-x1, \frac{y2 - y1}{x2}, y1\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y1 - y2}{x1}, -x2, y2\right)\\ \end{array} \end{array} \]
    (FPCore (y1 x2 y2 x1)
     :precision binary64
     (if (<= x1 0.108)
       (fma (- x1) (/ (- y2 y1) x2) y1)
       (fma (/ (- y1 y2) x1) (- x2) y2)))
    double code(double y1, double x2, double y2, double x1) {
    	double tmp;
    	if (x1 <= 0.108) {
    		tmp = fma(-x1, ((y2 - y1) / x2), y1);
    	} else {
    		tmp = fma(((y1 - y2) / x1), -x2, y2);
    	}
    	return tmp;
    }
    
    function code(y1, x2, y2, x1)
    	tmp = 0.0
    	if (x1 <= 0.108)
    		tmp = fma(Float64(-x1), Float64(Float64(y2 - y1) / x2), y1);
    	else
    		tmp = fma(Float64(Float64(y1 - y2) / x1), Float64(-x2), y2);
    	end
    	return tmp
    end
    
    code[y1_, x2_, y2_, x1_] := If[LessEqual[x1, 0.108], N[((-x1) * N[(N[(y2 - y1), $MachinePrecision] / x2), $MachinePrecision] + y1), $MachinePrecision], N[(N[(N[(y1 - y2), $MachinePrecision] / x1), $MachinePrecision] * (-x2) + y2), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x1 \leq 0.108:\\
    \;\;\;\;\mathsf{fma}\left(-x1, \frac{y2 - y1}{x2}, y1\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(\frac{y1 - y2}{x1}, -x2, y2\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x1 < 0.107999999999999999

      1. Initial program 84.3%

        \[\frac{y1 \cdot x2 - y2 \cdot x1}{x2 - x1} \]
      2. Add Preprocessing
      3. Taylor expanded in x2 around inf

        \[\leadsto \color{blue}{\left(y1 + -1 \cdot \frac{x1 \cdot y2}{x2}\right) - -1 \cdot \frac{x1 \cdot y1}{x2}} \]
      4. Step-by-step derivation
        1. associate--l+N/A

          \[\leadsto \color{blue}{y1 + \left(-1 \cdot \frac{x1 \cdot y2}{x2} - -1 \cdot \frac{x1 \cdot y1}{x2}\right)} \]
        2. associate-*r/N/A

          \[\leadsto y1 + \left(\color{blue}{\frac{-1 \cdot \left(x1 \cdot y2\right)}{x2}} - -1 \cdot \frac{x1 \cdot y1}{x2}\right) \]
        3. associate-*r/N/A

          \[\leadsto y1 + \left(\frac{-1 \cdot \left(x1 \cdot y2\right)}{x2} - \color{blue}{\frac{-1 \cdot \left(x1 \cdot y1\right)}{x2}}\right) \]
        4. div-subN/A

          \[\leadsto y1 + \color{blue}{\frac{-1 \cdot \left(x1 \cdot y2\right) - -1 \cdot \left(x1 \cdot y1\right)}{x2}} \]
        5. +-commutativeN/A

          \[\leadsto \color{blue}{\frac{-1 \cdot \left(x1 \cdot y2\right) - -1 \cdot \left(x1 \cdot y1\right)}{x2} + y1} \]
        6. associate-*r*N/A

          \[\leadsto \frac{\color{blue}{\left(-1 \cdot x1\right) \cdot y2} - -1 \cdot \left(x1 \cdot y1\right)}{x2} + y1 \]
        7. associate-*r*N/A

          \[\leadsto \frac{\left(-1 \cdot x1\right) \cdot y2 - \color{blue}{\left(-1 \cdot x1\right) \cdot y1}}{x2} + y1 \]
        8. distribute-lft-out--N/A

          \[\leadsto \frac{\color{blue}{\left(-1 \cdot x1\right) \cdot \left(y2 - y1\right)}}{x2} + y1 \]
        9. associate-/l*N/A

          \[\leadsto \color{blue}{\left(-1 \cdot x1\right) \cdot \frac{y2 - y1}{x2}} + y1 \]
        10. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(-1 \cdot x1, \frac{y2 - y1}{x2}, y1\right)} \]
        11. mul-1-negN/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{neg}\left(x1\right)}, \frac{y2 - y1}{x2}, y1\right) \]
        12. lower-neg.f64N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{-x1}, \frac{y2 - y1}{x2}, y1\right) \]
        13. lower-/.f64N/A

          \[\leadsto \mathsf{fma}\left(-x1, \color{blue}{\frac{y2 - y1}{x2}}, y1\right) \]
        14. lower--.f6469.3

          \[\leadsto \mathsf{fma}\left(-x1, \frac{\color{blue}{y2 - y1}}{x2}, y1\right) \]
      5. Applied rewrites69.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-x1, \frac{y2 - y1}{x2}, y1\right)} \]

      if 0.107999999999999999 < x1

      1. Initial program 73.8%

        \[\frac{y1 \cdot x2 - y2 \cdot x1}{x2 - x1} \]
      2. Add Preprocessing
      3. Taylor expanded in x2 around 0

        \[\leadsto \color{blue}{y2 + x2 \cdot \left(-1 \cdot \frac{y1}{x1} - -1 \cdot \frac{y2}{x1}\right)} \]
      4. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto \color{blue}{x2 \cdot \left(-1 \cdot \frac{y1}{x1} - -1 \cdot \frac{y2}{x1}\right) + y2} \]
        2. distribute-lft-out--N/A

          \[\leadsto x2 \cdot \color{blue}{\left(-1 \cdot \left(\frac{y1}{x1} - \frac{y2}{x1}\right)\right)} + y2 \]
        3. associate-*r*N/A

          \[\leadsto \color{blue}{\left(x2 \cdot -1\right) \cdot \left(\frac{y1}{x1} - \frac{y2}{x1}\right)} + y2 \]
        4. *-commutativeN/A

          \[\leadsto \color{blue}{\left(-1 \cdot x2\right)} \cdot \left(\frac{y1}{x1} - \frac{y2}{x1}\right) + y2 \]
        5. *-commutativeN/A

          \[\leadsto \color{blue}{\left(\frac{y1}{x1} - \frac{y2}{x1}\right) \cdot \left(-1 \cdot x2\right)} + y2 \]
        6. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y1}{x1} - \frac{y2}{x1}, -1 \cdot x2, y2\right)} \]
        7. div-subN/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y1 - y2}{x1}}, -1 \cdot x2, y2\right) \]
        8. lower-/.f64N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y1 - y2}{x1}}, -1 \cdot x2, y2\right) \]
        9. lower--.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{y1 - y2}}{x1}, -1 \cdot x2, y2\right) \]
        10. mul-1-negN/A

          \[\leadsto \mathsf{fma}\left(\frac{y1 - y2}{x1}, \color{blue}{\mathsf{neg}\left(x2\right)}, y2\right) \]
        11. lower-neg.f6479.2

          \[\leadsto \mathsf{fma}\left(\frac{y1 - y2}{x1}, \color{blue}{-x2}, y2\right) \]
      5. Applied rewrites79.2%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y1 - y2}{x1}, -x2, y2\right)} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification74.6%

      \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq 0.108:\\ \;\;\;\;\mathsf{fma}\left(-x1, \frac{y2 - y1}{x2}, y1\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y1 - y2}{x1}, -x2, y2\right)\\ \end{array} \]
    5. Add Preprocessing

    Alternative 5: 70.7% accurate, 1.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x1 \leq 0.145:\\ \;\;\;\;\mathsf{fma}\left(-x1, \frac{y2 - y1}{x2}, y1\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y1}{x1}, -x2, y2\right)\\ \end{array} \end{array} \]
    (FPCore (y1 x2 y2 x1)
     :precision binary64
     (if (<= x1 0.145) (fma (- x1) (/ (- y2 y1) x2) y1) (fma (/ y1 x1) (- x2) y2)))
    double code(double y1, double x2, double y2, double x1) {
    	double tmp;
    	if (x1 <= 0.145) {
    		tmp = fma(-x1, ((y2 - y1) / x2), y1);
    	} else {
    		tmp = fma((y1 / x1), -x2, y2);
    	}
    	return tmp;
    }
    
    function code(y1, x2, y2, x1)
    	tmp = 0.0
    	if (x1 <= 0.145)
    		tmp = fma(Float64(-x1), Float64(Float64(y2 - y1) / x2), y1);
    	else
    		tmp = fma(Float64(y1 / x1), Float64(-x2), y2);
    	end
    	return tmp
    end
    
    code[y1_, x2_, y2_, x1_] := If[LessEqual[x1, 0.145], N[((-x1) * N[(N[(y2 - y1), $MachinePrecision] / x2), $MachinePrecision] + y1), $MachinePrecision], N[(N[(y1 / x1), $MachinePrecision] * (-x2) + y2), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x1 \leq 0.145:\\
    \;\;\;\;\mathsf{fma}\left(-x1, \frac{y2 - y1}{x2}, y1\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(\frac{y1}{x1}, -x2, y2\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x1 < 0.14499999999999999

      1. Initial program 84.3%

        \[\frac{y1 \cdot x2 - y2 \cdot x1}{x2 - x1} \]
      2. Add Preprocessing
      3. Taylor expanded in x2 around inf

        \[\leadsto \color{blue}{\left(y1 + -1 \cdot \frac{x1 \cdot y2}{x2}\right) - -1 \cdot \frac{x1 \cdot y1}{x2}} \]
      4. Step-by-step derivation
        1. associate--l+N/A

          \[\leadsto \color{blue}{y1 + \left(-1 \cdot \frac{x1 \cdot y2}{x2} - -1 \cdot \frac{x1 \cdot y1}{x2}\right)} \]
        2. associate-*r/N/A

          \[\leadsto y1 + \left(\color{blue}{\frac{-1 \cdot \left(x1 \cdot y2\right)}{x2}} - -1 \cdot \frac{x1 \cdot y1}{x2}\right) \]
        3. associate-*r/N/A

          \[\leadsto y1 + \left(\frac{-1 \cdot \left(x1 \cdot y2\right)}{x2} - \color{blue}{\frac{-1 \cdot \left(x1 \cdot y1\right)}{x2}}\right) \]
        4. div-subN/A

          \[\leadsto y1 + \color{blue}{\frac{-1 \cdot \left(x1 \cdot y2\right) - -1 \cdot \left(x1 \cdot y1\right)}{x2}} \]
        5. +-commutativeN/A

          \[\leadsto \color{blue}{\frac{-1 \cdot \left(x1 \cdot y2\right) - -1 \cdot \left(x1 \cdot y1\right)}{x2} + y1} \]
        6. associate-*r*N/A

          \[\leadsto \frac{\color{blue}{\left(-1 \cdot x1\right) \cdot y2} - -1 \cdot \left(x1 \cdot y1\right)}{x2} + y1 \]
        7. associate-*r*N/A

          \[\leadsto \frac{\left(-1 \cdot x1\right) \cdot y2 - \color{blue}{\left(-1 \cdot x1\right) \cdot y1}}{x2} + y1 \]
        8. distribute-lft-out--N/A

          \[\leadsto \frac{\color{blue}{\left(-1 \cdot x1\right) \cdot \left(y2 - y1\right)}}{x2} + y1 \]
        9. associate-/l*N/A

          \[\leadsto \color{blue}{\left(-1 \cdot x1\right) \cdot \frac{y2 - y1}{x2}} + y1 \]
        10. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(-1 \cdot x1, \frac{y2 - y1}{x2}, y1\right)} \]
        11. mul-1-negN/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{neg}\left(x1\right)}, \frac{y2 - y1}{x2}, y1\right) \]
        12. lower-neg.f64N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{-x1}, \frac{y2 - y1}{x2}, y1\right) \]
        13. lower-/.f64N/A

          \[\leadsto \mathsf{fma}\left(-x1, \color{blue}{\frac{y2 - y1}{x2}}, y1\right) \]
        14. lower--.f6469.3

          \[\leadsto \mathsf{fma}\left(-x1, \frac{\color{blue}{y2 - y1}}{x2}, y1\right) \]
      5. Applied rewrites69.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-x1, \frac{y2 - y1}{x2}, y1\right)} \]

      if 0.14499999999999999 < x1

      1. Initial program 73.8%

        \[\frac{y1 \cdot x2 - y2 \cdot x1}{x2 - x1} \]
      2. Add Preprocessing
      3. Taylor expanded in x2 around 0

        \[\leadsto \color{blue}{y2 + x2 \cdot \left(-1 \cdot \frac{y1}{x1} - -1 \cdot \frac{y2}{x1}\right)} \]
      4. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto \color{blue}{x2 \cdot \left(-1 \cdot \frac{y1}{x1} - -1 \cdot \frac{y2}{x1}\right) + y2} \]
        2. distribute-lft-out--N/A

          \[\leadsto x2 \cdot \color{blue}{\left(-1 \cdot \left(\frac{y1}{x1} - \frac{y2}{x1}\right)\right)} + y2 \]
        3. associate-*r*N/A

          \[\leadsto \color{blue}{\left(x2 \cdot -1\right) \cdot \left(\frac{y1}{x1} - \frac{y2}{x1}\right)} + y2 \]
        4. *-commutativeN/A

          \[\leadsto \color{blue}{\left(-1 \cdot x2\right)} \cdot \left(\frac{y1}{x1} - \frac{y2}{x1}\right) + y2 \]
        5. *-commutativeN/A

          \[\leadsto \color{blue}{\left(\frac{y1}{x1} - \frac{y2}{x1}\right) \cdot \left(-1 \cdot x2\right)} + y2 \]
        6. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y1}{x1} - \frac{y2}{x1}, -1 \cdot x2, y2\right)} \]
        7. div-subN/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y1 - y2}{x1}}, -1 \cdot x2, y2\right) \]
        8. lower-/.f64N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y1 - y2}{x1}}, -1 \cdot x2, y2\right) \]
        9. lower--.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{y1 - y2}}{x1}, -1 \cdot x2, y2\right) \]
        10. mul-1-negN/A

          \[\leadsto \mathsf{fma}\left(\frac{y1 - y2}{x1}, \color{blue}{\mathsf{neg}\left(x2\right)}, y2\right) \]
        11. lower-neg.f6479.2

          \[\leadsto \mathsf{fma}\left(\frac{y1 - y2}{x1}, \color{blue}{-x2}, y2\right) \]
      5. Applied rewrites79.2%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y1 - y2}{x1}, -x2, y2\right)} \]
      6. Taylor expanded in y1 around inf

        \[\leadsto \mathsf{fma}\left(\frac{y1}{x1}, -\color{blue}{x2}, y2\right) \]
      7. Step-by-step derivation
        1. Applied rewrites79.2%

          \[\leadsto \mathsf{fma}\left(\frac{y1}{x1}, -\color{blue}{x2}, y2\right) \]
      8. Recombined 2 regimes into one program.
      9. Final simplification74.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq 0.145:\\ \;\;\;\;\mathsf{fma}\left(-x1, \frac{y2 - y1}{x2}, y1\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y1}{x1}, -x2, y2\right)\\ \end{array} \]
      10. Add Preprocessing

      Alternative 6: 71.3% accurate, 1.1× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x1 \leq 140000000:\\ \;\;\;\;\frac{x2}{x2 - x1} \cdot y1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y1}{x1}, -x2, y2\right)\\ \end{array} \end{array} \]
      (FPCore (y1 x2 y2 x1)
       :precision binary64
       (if (<= x1 140000000.0) (* (/ x2 (- x2 x1)) y1) (fma (/ y1 x1) (- x2) y2)))
      double code(double y1, double x2, double y2, double x1) {
      	double tmp;
      	if (x1 <= 140000000.0) {
      		tmp = (x2 / (x2 - x1)) * y1;
      	} else {
      		tmp = fma((y1 / x1), -x2, y2);
      	}
      	return tmp;
      }
      
      function code(y1, x2, y2, x1)
      	tmp = 0.0
      	if (x1 <= 140000000.0)
      		tmp = Float64(Float64(x2 / Float64(x2 - x1)) * y1);
      	else
      		tmp = fma(Float64(y1 / x1), Float64(-x2), y2);
      	end
      	return tmp
      end
      
      code[y1_, x2_, y2_, x1_] := If[LessEqual[x1, 140000000.0], N[(N[(x2 / N[(x2 - x1), $MachinePrecision]), $MachinePrecision] * y1), $MachinePrecision], N[(N[(y1 / x1), $MachinePrecision] * (-x2) + y2), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;x1 \leq 140000000:\\
      \;\;\;\;\frac{x2}{x2 - x1} \cdot y1\\
      
      \mathbf{else}:\\
      \;\;\;\;\mathsf{fma}\left(\frac{y1}{x1}, -x2, y2\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if x1 < 1.4e8

        1. Initial program 85.3%

          \[\frac{y1 \cdot x2 - y2 \cdot x1}{x2 - x1} \]
        2. Add Preprocessing
        3. Taylor expanded in y2 around inf

          \[\leadsto \color{blue}{y2 \cdot \left(-1 \cdot \frac{x1}{x2 - x1} + \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right)} \]
        4. Step-by-step derivation
          1. mul-1-negN/A

            \[\leadsto y2 \cdot \left(\color{blue}{\left(\mathsf{neg}\left(\frac{x1}{x2 - x1}\right)\right)} + \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right) \]
          2. neg-sub0N/A

            \[\leadsto y2 \cdot \left(\color{blue}{\left(0 - \frac{x1}{x2 - x1}\right)} + \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right) \]
          3. associate-+l-N/A

            \[\leadsto y2 \cdot \color{blue}{\left(0 - \left(\frac{x1}{x2 - x1} - \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right)\right)} \]
          4. unsub-negN/A

            \[\leadsto y2 \cdot \left(0 - \color{blue}{\left(\frac{x1}{x2 - x1} + \left(\mathsf{neg}\left(\frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right)\right)\right)}\right) \]
          5. mul-1-negN/A

            \[\leadsto y2 \cdot \left(0 - \left(\frac{x1}{x2 - x1} + \color{blue}{-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}}\right)\right) \]
          6. +-commutativeN/A

            \[\leadsto y2 \cdot \left(0 - \color{blue}{\left(-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)} + \frac{x1}{x2 - x1}\right)}\right) \]
          7. neg-sub0N/A

            \[\leadsto y2 \cdot \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)} + \frac{x1}{x2 - x1}\right)\right)\right)} \]
          8. *-commutativeN/A

            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)} + \frac{x1}{x2 - x1}\right)\right)\right) \cdot y2} \]
          9. lower-*.f64N/A

            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)} + \frac{x1}{x2 - x1}\right)\right)\right) \cdot y2} \]
        5. Applied rewrites89.2%

          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\frac{x2}{x2 - x1}}{y2}, y1, \frac{x1}{x1 - x2}\right) \cdot y2} \]
        6. Taylor expanded in y1 around inf

          \[\leadsto \frac{x2 \cdot y1}{\color{blue}{x2 - x1}} \]
        7. Step-by-step derivation
          1. Applied rewrites67.9%

            \[\leadsto \frac{x2}{x2 - x1} \cdot \color{blue}{y1} \]

          if 1.4e8 < x1

          1. Initial program 72.2%

            \[\frac{y1 \cdot x2 - y2 \cdot x1}{x2 - x1} \]
          2. Add Preprocessing
          3. Taylor expanded in x2 around 0

            \[\leadsto \color{blue}{y2 + x2 \cdot \left(-1 \cdot \frac{y1}{x1} - -1 \cdot \frac{y2}{x1}\right)} \]
          4. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto \color{blue}{x2 \cdot \left(-1 \cdot \frac{y1}{x1} - -1 \cdot \frac{y2}{x1}\right) + y2} \]
            2. distribute-lft-out--N/A

              \[\leadsto x2 \cdot \color{blue}{\left(-1 \cdot \left(\frac{y1}{x1} - \frac{y2}{x1}\right)\right)} + y2 \]
            3. associate-*r*N/A

              \[\leadsto \color{blue}{\left(x2 \cdot -1\right) \cdot \left(\frac{y1}{x1} - \frac{y2}{x1}\right)} + y2 \]
            4. *-commutativeN/A

              \[\leadsto \color{blue}{\left(-1 \cdot x2\right)} \cdot \left(\frac{y1}{x1} - \frac{y2}{x1}\right) + y2 \]
            5. *-commutativeN/A

              \[\leadsto \color{blue}{\left(\frac{y1}{x1} - \frac{y2}{x1}\right) \cdot \left(-1 \cdot x2\right)} + y2 \]
            6. lower-fma.f64N/A

              \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y1}{x1} - \frac{y2}{x1}, -1 \cdot x2, y2\right)} \]
            7. div-subN/A

              \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y1 - y2}{x1}}, -1 \cdot x2, y2\right) \]
            8. lower-/.f64N/A

              \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y1 - y2}{x1}}, -1 \cdot x2, y2\right) \]
            9. lower--.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{y1 - y2}}{x1}, -1 \cdot x2, y2\right) \]
            10. mul-1-negN/A

              \[\leadsto \mathsf{fma}\left(\frac{y1 - y2}{x1}, \color{blue}{\mathsf{neg}\left(x2\right)}, y2\right) \]
            11. lower-neg.f6481.0

              \[\leadsto \mathsf{fma}\left(\frac{y1 - y2}{x1}, \color{blue}{-x2}, y2\right) \]
          5. Applied rewrites81.0%

            \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y1 - y2}{x1}, -x2, y2\right)} \]
          6. Taylor expanded in y1 around inf

            \[\leadsto \mathsf{fma}\left(\frac{y1}{x1}, -\color{blue}{x2}, y2\right) \]
          7. Step-by-step derivation
            1. Applied rewrites80.9%

              \[\leadsto \mathsf{fma}\left(\frac{y1}{x1}, -\color{blue}{x2}, y2\right) \]
          8. Recombined 2 regimes into one program.
          9. Final simplification74.5%

            \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq 140000000:\\ \;\;\;\;\frac{x2}{x2 - x1} \cdot y1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y1}{x1}, -x2, y2\right)\\ \end{array} \]
          10. Add Preprocessing

          Alternative 7: 67.0% accurate, 1.1× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y2 \leq 5.5 \cdot 10^{+16}:\\ \;\;\;\;\frac{x2}{x2 - x1} \cdot y1\\ \mathbf{else}:\\ \;\;\;\;\frac{x1}{x1 - x2} \cdot y2\\ \end{array} \end{array} \]
          (FPCore (y1 x2 y2 x1)
           :precision binary64
           (if (<= y2 5.5e+16) (* (/ x2 (- x2 x1)) y1) (* (/ x1 (- x1 x2)) y2)))
          double code(double y1, double x2, double y2, double x1) {
          	double tmp;
          	if (y2 <= 5.5e+16) {
          		tmp = (x2 / (x2 - x1)) * y1;
          	} else {
          		tmp = (x1 / (x1 - x2)) * y2;
          	}
          	return tmp;
          }
          
          real(8) function code(y1, x2, y2, x1)
              real(8), intent (in) :: y1
              real(8), intent (in) :: x2
              real(8), intent (in) :: y2
              real(8), intent (in) :: x1
              real(8) :: tmp
              if (y2 <= 5.5d+16) then
                  tmp = (x2 / (x2 - x1)) * y1
              else
                  tmp = (x1 / (x1 - x2)) * y2
              end if
              code = tmp
          end function
          
          public static double code(double y1, double x2, double y2, double x1) {
          	double tmp;
          	if (y2 <= 5.5e+16) {
          		tmp = (x2 / (x2 - x1)) * y1;
          	} else {
          		tmp = (x1 / (x1 - x2)) * y2;
          	}
          	return tmp;
          }
          
          def code(y1, x2, y2, x1):
          	tmp = 0
          	if y2 <= 5.5e+16:
          		tmp = (x2 / (x2 - x1)) * y1
          	else:
          		tmp = (x1 / (x1 - x2)) * y2
          	return tmp
          
          function code(y1, x2, y2, x1)
          	tmp = 0.0
          	if (y2 <= 5.5e+16)
          		tmp = Float64(Float64(x2 / Float64(x2 - x1)) * y1);
          	else
          		tmp = Float64(Float64(x1 / Float64(x1 - x2)) * y2);
          	end
          	return tmp
          end
          
          function tmp_2 = code(y1, x2, y2, x1)
          	tmp = 0.0;
          	if (y2 <= 5.5e+16)
          		tmp = (x2 / (x2 - x1)) * y1;
          	else
          		tmp = (x1 / (x1 - x2)) * y2;
          	end
          	tmp_2 = tmp;
          end
          
          code[y1_, x2_, y2_, x1_] := If[LessEqual[y2, 5.5e+16], N[(N[(x2 / N[(x2 - x1), $MachinePrecision]), $MachinePrecision] * y1), $MachinePrecision], N[(N[(x1 / N[(x1 - x2), $MachinePrecision]), $MachinePrecision] * y2), $MachinePrecision]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;y2 \leq 5.5 \cdot 10^{+16}:\\
          \;\;\;\;\frac{x2}{x2 - x1} \cdot y1\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{x1}{x1 - x2} \cdot y2\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if y2 < 5.5e16

            1. Initial program 85.5%

              \[\frac{y1 \cdot x2 - y2 \cdot x1}{x2 - x1} \]
            2. Add Preprocessing
            3. Taylor expanded in y2 around inf

              \[\leadsto \color{blue}{y2 \cdot \left(-1 \cdot \frac{x1}{x2 - x1} + \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right)} \]
            4. Step-by-step derivation
              1. mul-1-negN/A

                \[\leadsto y2 \cdot \left(\color{blue}{\left(\mathsf{neg}\left(\frac{x1}{x2 - x1}\right)\right)} + \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right) \]
              2. neg-sub0N/A

                \[\leadsto y2 \cdot \left(\color{blue}{\left(0 - \frac{x1}{x2 - x1}\right)} + \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right) \]
              3. associate-+l-N/A

                \[\leadsto y2 \cdot \color{blue}{\left(0 - \left(\frac{x1}{x2 - x1} - \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right)\right)} \]
              4. unsub-negN/A

                \[\leadsto y2 \cdot \left(0 - \color{blue}{\left(\frac{x1}{x2 - x1} + \left(\mathsf{neg}\left(\frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right)\right)\right)}\right) \]
              5. mul-1-negN/A

                \[\leadsto y2 \cdot \left(0 - \left(\frac{x1}{x2 - x1} + \color{blue}{-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}}\right)\right) \]
              6. +-commutativeN/A

                \[\leadsto y2 \cdot \left(0 - \color{blue}{\left(-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)} + \frac{x1}{x2 - x1}\right)}\right) \]
              7. neg-sub0N/A

                \[\leadsto y2 \cdot \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)} + \frac{x1}{x2 - x1}\right)\right)\right)} \]
              8. *-commutativeN/A

                \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)} + \frac{x1}{x2 - x1}\right)\right)\right) \cdot y2} \]
              9. lower-*.f64N/A

                \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)} + \frac{x1}{x2 - x1}\right)\right)\right) \cdot y2} \]
            5. Applied rewrites85.1%

              \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\frac{x2}{x2 - x1}}{y2}, y1, \frac{x1}{x1 - x2}\right) \cdot y2} \]
            6. Taylor expanded in y1 around inf

              \[\leadsto \frac{x2 \cdot y1}{\color{blue}{x2 - x1}} \]
            7. Step-by-step derivation
              1. Applied rewrites70.0%

                \[\leadsto \frac{x2}{x2 - x1} \cdot \color{blue}{y1} \]

              if 5.5e16 < y2

              1. Initial program 70.1%

                \[\frac{y1 \cdot x2 - y2 \cdot x1}{x2 - x1} \]
              2. Add Preprocessing
              3. Taylor expanded in y1 around 0

                \[\leadsto \color{blue}{-1 \cdot \frac{x1 \cdot y2}{x2 - x1}} \]
              4. Step-by-step derivation
                1. associate-*l/N/A

                  \[\leadsto -1 \cdot \color{blue}{\left(\frac{x1}{x2 - x1} \cdot y2\right)} \]
                2. associate-*l*N/A

                  \[\leadsto \color{blue}{\left(-1 \cdot \frac{x1}{x2 - x1}\right) \cdot y2} \]
                3. lower-*.f64N/A

                  \[\leadsto \color{blue}{\left(-1 \cdot \frac{x1}{x2 - x1}\right) \cdot y2} \]
                4. mul-1-negN/A

                  \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{x1}{x2 - x1}\right)\right)} \cdot y2 \]
                5. distribute-neg-frac2N/A

                  \[\leadsto \color{blue}{\frac{x1}{\mathsf{neg}\left(\left(x2 - x1\right)\right)}} \cdot y2 \]
                6. lower-/.f64N/A

                  \[\leadsto \color{blue}{\frac{x1}{\mathsf{neg}\left(\left(x2 - x1\right)\right)}} \cdot y2 \]
                7. sub-negN/A

                  \[\leadsto \frac{x1}{\mathsf{neg}\left(\color{blue}{\left(x2 + \left(\mathsf{neg}\left(x1\right)\right)\right)}\right)} \cdot y2 \]
                8. mul-1-negN/A

                  \[\leadsto \frac{x1}{\mathsf{neg}\left(\left(x2 + \color{blue}{-1 \cdot x1}\right)\right)} \cdot y2 \]
                9. +-commutativeN/A

                  \[\leadsto \frac{x1}{\mathsf{neg}\left(\color{blue}{\left(-1 \cdot x1 + x2\right)}\right)} \cdot y2 \]
                10. distribute-neg-inN/A

                  \[\leadsto \frac{x1}{\color{blue}{\left(\mathsf{neg}\left(-1 \cdot x1\right)\right) + \left(\mathsf{neg}\left(x2\right)\right)}} \cdot y2 \]
                11. mul-1-negN/A

                  \[\leadsto \frac{x1}{\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x1\right)\right)}\right)\right) + \left(\mathsf{neg}\left(x2\right)\right)} \cdot y2 \]
                12. remove-double-negN/A

                  \[\leadsto \frac{x1}{\color{blue}{x1} + \left(\mathsf{neg}\left(x2\right)\right)} \cdot y2 \]
                13. sub-negN/A

                  \[\leadsto \frac{x1}{\color{blue}{x1 - x2}} \cdot y2 \]
                14. lower--.f6472.9

                  \[\leadsto \frac{x1}{\color{blue}{x1 - x2}} \cdot y2 \]
              5. Applied rewrites72.9%

                \[\leadsto \color{blue}{\frac{x1}{x1 - x2} \cdot y2} \]
            8. Recombined 2 regimes into one program.
            9. Final simplification71.3%

              \[\leadsto \begin{array}{l} \mathbf{if}\;y2 \leq 5.5 \cdot 10^{+16}:\\ \;\;\;\;\frac{x2}{x2 - x1} \cdot y1\\ \mathbf{else}:\\ \;\;\;\;\frac{x1}{x1 - x2} \cdot y2\\ \end{array} \]
            10. Add Preprocessing

            Alternative 8: 63.0% accurate, 1.1× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x2 \leq 4.5 \cdot 10^{-124}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x2}{x1}, y2, y2\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x2}{x2 - x1} \cdot y1\\ \end{array} \end{array} \]
            (FPCore (y1 x2 y2 x1)
             :precision binary64
             (if (<= x2 4.5e-124) (fma (/ x2 x1) y2 y2) (* (/ x2 (- x2 x1)) y1)))
            double code(double y1, double x2, double y2, double x1) {
            	double tmp;
            	if (x2 <= 4.5e-124) {
            		tmp = fma((x2 / x1), y2, y2);
            	} else {
            		tmp = (x2 / (x2 - x1)) * y1;
            	}
            	return tmp;
            }
            
            function code(y1, x2, y2, x1)
            	tmp = 0.0
            	if (x2 <= 4.5e-124)
            		tmp = fma(Float64(x2 / x1), y2, y2);
            	else
            		tmp = Float64(Float64(x2 / Float64(x2 - x1)) * y1);
            	end
            	return tmp
            end
            
            code[y1_, x2_, y2_, x1_] := If[LessEqual[x2, 4.5e-124], N[(N[(x2 / x1), $MachinePrecision] * y2 + y2), $MachinePrecision], N[(N[(x2 / N[(x2 - x1), $MachinePrecision]), $MachinePrecision] * y1), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;x2 \leq 4.5 \cdot 10^{-124}:\\
            \;\;\;\;\mathsf{fma}\left(\frac{x2}{x1}, y2, y2\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;\frac{x2}{x2 - x1} \cdot y1\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if x2 < 4.4999999999999996e-124

              1. Initial program 82.5%

                \[\frac{y1 \cdot x2 - y2 \cdot x1}{x2 - x1} \]
              2. Add Preprocessing
              3. Taylor expanded in x2 around 0

                \[\leadsto \color{blue}{y2 + x2 \cdot \left(-1 \cdot \frac{y1}{x1} - -1 \cdot \frac{y2}{x1}\right)} \]
              4. Step-by-step derivation
                1. +-commutativeN/A

                  \[\leadsto \color{blue}{x2 \cdot \left(-1 \cdot \frac{y1}{x1} - -1 \cdot \frac{y2}{x1}\right) + y2} \]
                2. distribute-lft-out--N/A

                  \[\leadsto x2 \cdot \color{blue}{\left(-1 \cdot \left(\frac{y1}{x1} - \frac{y2}{x1}\right)\right)} + y2 \]
                3. associate-*r*N/A

                  \[\leadsto \color{blue}{\left(x2 \cdot -1\right) \cdot \left(\frac{y1}{x1} - \frac{y2}{x1}\right)} + y2 \]
                4. *-commutativeN/A

                  \[\leadsto \color{blue}{\left(-1 \cdot x2\right)} \cdot \left(\frac{y1}{x1} - \frac{y2}{x1}\right) + y2 \]
                5. *-commutativeN/A

                  \[\leadsto \color{blue}{\left(\frac{y1}{x1} - \frac{y2}{x1}\right) \cdot \left(-1 \cdot x2\right)} + y2 \]
                6. lower-fma.f64N/A

                  \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y1}{x1} - \frac{y2}{x1}, -1 \cdot x2, y2\right)} \]
                7. div-subN/A

                  \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y1 - y2}{x1}}, -1 \cdot x2, y2\right) \]
                8. lower-/.f64N/A

                  \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y1 - y2}{x1}}, -1 \cdot x2, y2\right) \]
                9. lower--.f64N/A

                  \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{y1 - y2}}{x1}, -1 \cdot x2, y2\right) \]
                10. mul-1-negN/A

                  \[\leadsto \mathsf{fma}\left(\frac{y1 - y2}{x1}, \color{blue}{\mathsf{neg}\left(x2\right)}, y2\right) \]
                11. lower-neg.f6479.1

                  \[\leadsto \mathsf{fma}\left(\frac{y1 - y2}{x1}, \color{blue}{-x2}, y2\right) \]
              5. Applied rewrites79.1%

                \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y1 - y2}{x1}, -x2, y2\right)} \]
              6. Taylor expanded in y1 around 0

                \[\leadsto y2 + \color{blue}{\frac{x2 \cdot y2}{x1}} \]
              7. Step-by-step derivation
                1. Applied rewrites73.3%

                  \[\leadsto \mathsf{fma}\left(\frac{x2}{x1}, \color{blue}{y2}, y2\right) \]

                if 4.4999999999999996e-124 < x2

                1. Initial program 76.7%

                  \[\frac{y1 \cdot x2 - y2 \cdot x1}{x2 - x1} \]
                2. Add Preprocessing
                3. Taylor expanded in y2 around inf

                  \[\leadsto \color{blue}{y2 \cdot \left(-1 \cdot \frac{x1}{x2 - x1} + \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right)} \]
                4. Step-by-step derivation
                  1. mul-1-negN/A

                    \[\leadsto y2 \cdot \left(\color{blue}{\left(\mathsf{neg}\left(\frac{x1}{x2 - x1}\right)\right)} + \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right) \]
                  2. neg-sub0N/A

                    \[\leadsto y2 \cdot \left(\color{blue}{\left(0 - \frac{x1}{x2 - x1}\right)} + \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right) \]
                  3. associate-+l-N/A

                    \[\leadsto y2 \cdot \color{blue}{\left(0 - \left(\frac{x1}{x2 - x1} - \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right)\right)} \]
                  4. unsub-negN/A

                    \[\leadsto y2 \cdot \left(0 - \color{blue}{\left(\frac{x1}{x2 - x1} + \left(\mathsf{neg}\left(\frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right)\right)\right)}\right) \]
                  5. mul-1-negN/A

                    \[\leadsto y2 \cdot \left(0 - \left(\frac{x1}{x2 - x1} + \color{blue}{-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}}\right)\right) \]
                  6. +-commutativeN/A

                    \[\leadsto y2 \cdot \left(0 - \color{blue}{\left(-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)} + \frac{x1}{x2 - x1}\right)}\right) \]
                  7. neg-sub0N/A

                    \[\leadsto y2 \cdot \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)} + \frac{x1}{x2 - x1}\right)\right)\right)} \]
                  8. *-commutativeN/A

                    \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)} + \frac{x1}{x2 - x1}\right)\right)\right) \cdot y2} \]
                  9. lower-*.f64N/A

                    \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)} + \frac{x1}{x2 - x1}\right)\right)\right) \cdot y2} \]
                5. Applied rewrites88.3%

                  \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\frac{x2}{x2 - x1}}{y2}, y1, \frac{x1}{x1 - x2}\right) \cdot y2} \]
                6. Taylor expanded in y1 around inf

                  \[\leadsto \frac{x2 \cdot y1}{\color{blue}{x2 - x1}} \]
                7. Step-by-step derivation
                  1. Applied rewrites63.8%

                    \[\leadsto \frac{x2}{x2 - x1} \cdot \color{blue}{y1} \]
                8. Recombined 2 regimes into one program.
                9. Final simplification67.0%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;x2 \leq 4.5 \cdot 10^{-124}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x2}{x1}, y2, y2\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x2}{x2 - x1} \cdot y1\\ \end{array} \]
                10. Add Preprocessing

                Alternative 9: 53.3% accurate, 1.2× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x1 \leq 6.1 \cdot 10^{-79}:\\ \;\;\;\;\frac{y1}{y2} \cdot y2\\ \mathbf{else}:\\ \;\;\;\;1 \cdot y2\\ \end{array} \end{array} \]
                (FPCore (y1 x2 y2 x1)
                 :precision binary64
                 (if (<= x1 6.1e-79) (* (/ y1 y2) y2) (* 1.0 y2)))
                double code(double y1, double x2, double y2, double x1) {
                	double tmp;
                	if (x1 <= 6.1e-79) {
                		tmp = (y1 / y2) * y2;
                	} else {
                		tmp = 1.0 * y2;
                	}
                	return tmp;
                }
                
                real(8) function code(y1, x2, y2, x1)
                    real(8), intent (in) :: y1
                    real(8), intent (in) :: x2
                    real(8), intent (in) :: y2
                    real(8), intent (in) :: x1
                    real(8) :: tmp
                    if (x1 <= 6.1d-79) then
                        tmp = (y1 / y2) * y2
                    else
                        tmp = 1.0d0 * y2
                    end if
                    code = tmp
                end function
                
                public static double code(double y1, double x2, double y2, double x1) {
                	double tmp;
                	if (x1 <= 6.1e-79) {
                		tmp = (y1 / y2) * y2;
                	} else {
                		tmp = 1.0 * y2;
                	}
                	return tmp;
                }
                
                def code(y1, x2, y2, x1):
                	tmp = 0
                	if x1 <= 6.1e-79:
                		tmp = (y1 / y2) * y2
                	else:
                		tmp = 1.0 * y2
                	return tmp
                
                function code(y1, x2, y2, x1)
                	tmp = 0.0
                	if (x1 <= 6.1e-79)
                		tmp = Float64(Float64(y1 / y2) * y2);
                	else
                		tmp = Float64(1.0 * y2);
                	end
                	return tmp
                end
                
                function tmp_2 = code(y1, x2, y2, x1)
                	tmp = 0.0;
                	if (x1 <= 6.1e-79)
                		tmp = (y1 / y2) * y2;
                	else
                		tmp = 1.0 * y2;
                	end
                	tmp_2 = tmp;
                end
                
                code[y1_, x2_, y2_, x1_] := If[LessEqual[x1, 6.1e-79], N[(N[(y1 / y2), $MachinePrecision] * y2), $MachinePrecision], N[(1.0 * y2), $MachinePrecision]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;x1 \leq 6.1 \cdot 10^{-79}:\\
                \;\;\;\;\frac{y1}{y2} \cdot y2\\
                
                \mathbf{else}:\\
                \;\;\;\;1 \cdot y2\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if x1 < 6.1000000000000005e-79

                  1. Initial program 80.8%

                    \[\frac{y1 \cdot x2 - y2 \cdot x1}{x2 - x1} \]
                  2. Add Preprocessing
                  3. Taylor expanded in y2 around inf

                    \[\leadsto \color{blue}{y2 \cdot \left(-1 \cdot \frac{x1}{x2 - x1} + \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right)} \]
                  4. Step-by-step derivation
                    1. mul-1-negN/A

                      \[\leadsto y2 \cdot \left(\color{blue}{\left(\mathsf{neg}\left(\frac{x1}{x2 - x1}\right)\right)} + \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right) \]
                    2. neg-sub0N/A

                      \[\leadsto y2 \cdot \left(\color{blue}{\left(0 - \frac{x1}{x2 - x1}\right)} + \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right) \]
                    3. associate-+l-N/A

                      \[\leadsto y2 \cdot \color{blue}{\left(0 - \left(\frac{x1}{x2 - x1} - \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right)\right)} \]
                    4. unsub-negN/A

                      \[\leadsto y2 \cdot \left(0 - \color{blue}{\left(\frac{x1}{x2 - x1} + \left(\mathsf{neg}\left(\frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right)\right)\right)}\right) \]
                    5. mul-1-negN/A

                      \[\leadsto y2 \cdot \left(0 - \left(\frac{x1}{x2 - x1} + \color{blue}{-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}}\right)\right) \]
                    6. +-commutativeN/A

                      \[\leadsto y2 \cdot \left(0 - \color{blue}{\left(-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)} + \frac{x1}{x2 - x1}\right)}\right) \]
                    7. neg-sub0N/A

                      \[\leadsto y2 \cdot \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)} + \frac{x1}{x2 - x1}\right)\right)\right)} \]
                    8. *-commutativeN/A

                      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)} + \frac{x1}{x2 - x1}\right)\right)\right) \cdot y2} \]
                    9. lower-*.f64N/A

                      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)} + \frac{x1}{x2 - x1}\right)\right)\right) \cdot y2} \]
                  5. Applied rewrites86.2%

                    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\frac{x2}{x2 - x1}}{y2}, y1, \frac{x1}{x1 - x2}\right) \cdot y2} \]
                  6. Taylor expanded in x2 around inf

                    \[\leadsto \frac{y1}{y2} \cdot y2 \]
                  7. Step-by-step derivation
                    1. Applied rewrites54.9%

                      \[\leadsto \frac{y1}{y2} \cdot y2 \]

                    if 6.1000000000000005e-79 < x1

                    1. Initial program 77.5%

                      \[\frac{y1 \cdot x2 - y2 \cdot x1}{x2 - x1} \]
                    2. Add Preprocessing
                    3. Taylor expanded in y2 around inf

                      \[\leadsto \color{blue}{y2 \cdot \left(-1 \cdot \frac{x1}{x2 - x1} + \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right)} \]
                    4. Step-by-step derivation
                      1. mul-1-negN/A

                        \[\leadsto y2 \cdot \left(\color{blue}{\left(\mathsf{neg}\left(\frac{x1}{x2 - x1}\right)\right)} + \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right) \]
                      2. neg-sub0N/A

                        \[\leadsto y2 \cdot \left(\color{blue}{\left(0 - \frac{x1}{x2 - x1}\right)} + \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right) \]
                      3. associate-+l-N/A

                        \[\leadsto y2 \cdot \color{blue}{\left(0 - \left(\frac{x1}{x2 - x1} - \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right)\right)} \]
                      4. unsub-negN/A

                        \[\leadsto y2 \cdot \left(0 - \color{blue}{\left(\frac{x1}{x2 - x1} + \left(\mathsf{neg}\left(\frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right)\right)\right)}\right) \]
                      5. mul-1-negN/A

                        \[\leadsto y2 \cdot \left(0 - \left(\frac{x1}{x2 - x1} + \color{blue}{-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}}\right)\right) \]
                      6. +-commutativeN/A

                        \[\leadsto y2 \cdot \left(0 - \color{blue}{\left(-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)} + \frac{x1}{x2 - x1}\right)}\right) \]
                      7. neg-sub0N/A

                        \[\leadsto y2 \cdot \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)} + \frac{x1}{x2 - x1}\right)\right)\right)} \]
                      8. *-commutativeN/A

                        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)} + \frac{x1}{x2 - x1}\right)\right)\right) \cdot y2} \]
                      9. lower-*.f64N/A

                        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)} + \frac{x1}{x2 - x1}\right)\right)\right) \cdot y2} \]
                    5. Applied rewrites93.5%

                      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\frac{x2}{x2 - x1}}{y2}, y1, \frac{x1}{x1 - x2}\right) \cdot y2} \]
                    6. Taylor expanded in x2 around 0

                      \[\leadsto 1 \cdot y2 \]
                    7. Step-by-step derivation
                      1. Applied rewrites55.0%

                        \[\leadsto 1 \cdot y2 \]
                    8. Recombined 2 regimes into one program.
                    9. Final simplification55.0%

                      \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq 6.1 \cdot 10^{-79}:\\ \;\;\;\;\frac{y1}{y2} \cdot y2\\ \mathbf{else}:\\ \;\;\;\;1 \cdot y2\\ \end{array} \]
                    10. Add Preprocessing

                    Alternative 10: 38.4% accurate, 4.7× speedup?

                    \[\begin{array}{l} \\ 1 \cdot y2 \end{array} \]
                    (FPCore (y1 x2 y2 x1) :precision binary64 (* 1.0 y2))
                    double code(double y1, double x2, double y2, double x1) {
                    	return 1.0 * y2;
                    }
                    
                    real(8) function code(y1, x2, y2, x1)
                        real(8), intent (in) :: y1
                        real(8), intent (in) :: x2
                        real(8), intent (in) :: y2
                        real(8), intent (in) :: x1
                        code = 1.0d0 * y2
                    end function
                    
                    public static double code(double y1, double x2, double y2, double x1) {
                    	return 1.0 * y2;
                    }
                    
                    def code(y1, x2, y2, x1):
                    	return 1.0 * y2
                    
                    function code(y1, x2, y2, x1)
                    	return Float64(1.0 * y2)
                    end
                    
                    function tmp = code(y1, x2, y2, x1)
                    	tmp = 1.0 * y2;
                    end
                    
                    code[y1_, x2_, y2_, x1_] := N[(1.0 * y2), $MachinePrecision]
                    
                    \begin{array}{l}
                    
                    \\
                    1 \cdot y2
                    \end{array}
                    
                    Derivation
                    1. Initial program 78.6%

                      \[\frac{y1 \cdot x2 - y2 \cdot x1}{x2 - x1} \]
                    2. Add Preprocessing
                    3. Taylor expanded in y2 around inf

                      \[\leadsto \color{blue}{y2 \cdot \left(-1 \cdot \frac{x1}{x2 - x1} + \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right)} \]
                    4. Step-by-step derivation
                      1. mul-1-negN/A

                        \[\leadsto y2 \cdot \left(\color{blue}{\left(\mathsf{neg}\left(\frac{x1}{x2 - x1}\right)\right)} + \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right) \]
                      2. neg-sub0N/A

                        \[\leadsto y2 \cdot \left(\color{blue}{\left(0 - \frac{x1}{x2 - x1}\right)} + \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right) \]
                      3. associate-+l-N/A

                        \[\leadsto y2 \cdot \color{blue}{\left(0 - \left(\frac{x1}{x2 - x1} - \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right)\right)} \]
                      4. unsub-negN/A

                        \[\leadsto y2 \cdot \left(0 - \color{blue}{\left(\frac{x1}{x2 - x1} + \left(\mathsf{neg}\left(\frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}\right)\right)\right)}\right) \]
                      5. mul-1-negN/A

                        \[\leadsto y2 \cdot \left(0 - \left(\frac{x1}{x2 - x1} + \color{blue}{-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)}}\right)\right) \]
                      6. +-commutativeN/A

                        \[\leadsto y2 \cdot \left(0 - \color{blue}{\left(-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)} + \frac{x1}{x2 - x1}\right)}\right) \]
                      7. neg-sub0N/A

                        \[\leadsto y2 \cdot \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)} + \frac{x1}{x2 - x1}\right)\right)\right)} \]
                      8. *-commutativeN/A

                        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)} + \frac{x1}{x2 - x1}\right)\right)\right) \cdot y2} \]
                      9. lower-*.f64N/A

                        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot \frac{x2 \cdot y1}{y2 \cdot \left(x2 - x1\right)} + \frac{x1}{x2 - x1}\right)\right)\right) \cdot y2} \]
                    5. Applied rewrites90.9%

                      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\frac{x2}{x2 - x1}}{y2}, y1, \frac{x1}{x1 - x2}\right) \cdot y2} \]
                    6. Taylor expanded in x2 around 0

                      \[\leadsto 1 \cdot y2 \]
                    7. Step-by-step derivation
                      1. Applied rewrites40.2%

                        \[\leadsto 1 \cdot y2 \]
                      2. Final simplification40.2%

                        \[\leadsto 1 \cdot y2 \]
                      3. Add Preprocessing

                      Reproduce

                      ?
                      herbie shell --seed 1 
                      (FPCore (y1 x2 y2 x1)
                        :name "(y1 * x2 - y2 * x1) / (x2 - x1)"
                        :precision binary64
                        :pre (and (and (and (and (<= 0.0 y1) (<= y1 1.79e+308)) (and (<= 0.0 x2) (<= x2 1.79e+308))) (and (<= 0.0 y2) (<= y2 1.79e+308))) (and (<= 0.0 x1) (<= x1 1.79e+308)))
                        (/ (- (* y1 x2) (* y2 x1)) (- x2 x1)))