Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, A

Percentage Accurate: 100.0% → 100.0%
Time: 6.3s
Alternatives: 8
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \left(x + y\right) - x \cdot y \end{array} \]
(FPCore (x y) :precision binary64 (- (+ x y) (* x y)))
double code(double x, double y) {
	return (x + y) - (x * y);
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (x + y) - (x * y)
end function
public static double code(double x, double y) {
	return (x + y) - (x * y);
}
def code(x, y):
	return (x + y) - (x * y)
function code(x, y)
	return Float64(Float64(x + y) - Float64(x * y))
end
function tmp = code(x, y)
	tmp = (x + y) - (x * y);
end
code[x_, y_] := N[(N[(x + y), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(x + y\right) - x \cdot y
\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 8 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: 100.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(x + y\right) - x \cdot y \end{array} \]
(FPCore (x y) :precision binary64 (- (+ x y) (* x y)))
double code(double x, double y) {
	return (x + y) - (x * y);
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (x + y) - (x * y)
end function
public static double code(double x, double y) {
	return (x + y) - (x * y);
}
def code(x, y):
	return (x + y) - (x * y)
function code(x, y)
	return Float64(Float64(x + y) - Float64(x * y))
end
function tmp = code(x, y)
	tmp = (x + y) - (x * y);
end
code[x_, y_] := N[(N[(x + y), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(x + y\right) - x \cdot y
\end{array}

Alternative 1: 100.0% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ y + x \cdot \left(1 - y\right) \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 (+ y (* x (- 1.0 y))))
assert(x < y);
double code(double x, double y) {
	return y + (x * (1.0 - y));
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = y + (x * (1.0d0 - y))
end function
assert x < y;
public static double code(double x, double y) {
	return y + (x * (1.0 - y));
}
[x, y] = sort([x, y])
def code(x, y):
	return y + (x * (1.0 - y))
x, y = sort([x, y])
function code(x, y)
	return Float64(y + Float64(x * Float64(1.0 - y)))
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = y + (x * (1.0 - y));
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := N[(y + N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
y + x \cdot \left(1 - y\right)
\end{array}
Derivation
  1. Initial program 100.0%

    \[\left(x + y\right) - x \cdot y \]
  2. Step-by-step derivation
    1. associate--l+100.0%

      \[\leadsto \color{blue}{x + \left(y - x \cdot y\right)} \]
    2. +-commutative100.0%

      \[\leadsto \color{blue}{\left(y - x \cdot y\right) + x} \]
    3. remove-double-neg100.0%

      \[\leadsto \left(y - x \cdot y\right) + \color{blue}{\left(-\left(-x\right)\right)} \]
    4. unsub-neg100.0%

      \[\leadsto \color{blue}{\left(y - x \cdot y\right) - \left(-x\right)} \]
    5. cancel-sign-sub-inv100.0%

      \[\leadsto \color{blue}{\left(y + \left(-x\right) \cdot y\right)} - \left(-x\right) \]
    6. associate--l+100.0%

      \[\leadsto \color{blue}{y + \left(\left(-x\right) \cdot y - \left(-x\right)\right)} \]
    7. neg-mul-1100.0%

      \[\leadsto y + \left(\left(-x\right) \cdot y - \color{blue}{-1 \cdot x}\right) \]
    8. cancel-sign-sub-inv100.0%

      \[\leadsto y + \color{blue}{\left(\left(-x\right) \cdot y + \left(--1\right) \cdot x\right)} \]
    9. distribute-lft-neg-out100.0%

      \[\leadsto y + \left(\color{blue}{\left(-x \cdot y\right)} + \left(--1\right) \cdot x\right) \]
    10. distribute-rgt-neg-out100.0%

      \[\leadsto y + \left(\color{blue}{x \cdot \left(-y\right)} + \left(--1\right) \cdot x\right) \]
    11. *-commutative100.0%

      \[\leadsto y + \left(\color{blue}{\left(-y\right) \cdot x} + \left(--1\right) \cdot x\right) \]
    12. distribute-rgt-out100.0%

      \[\leadsto y + \color{blue}{x \cdot \left(\left(-y\right) + \left(--1\right)\right)} \]
    13. +-commutative100.0%

      \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) + \left(-y\right)\right)} \]
    14. sub-neg100.0%

      \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) - y\right)} \]
    15. metadata-eval100.0%

      \[\leadsto y + x \cdot \left(\color{blue}{1} - y\right) \]
  3. Simplified100.0%

    \[\leadsto \color{blue}{y + x \cdot \left(1 - y\right)} \]
  4. Add Preprocessing
  5. Add Preprocessing

Alternative 2: 77.7% accurate, 0.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -9 \cdot 10^{+183} \lor \neg \left(x \leq -1.6 \cdot 10^{+66}\right) \land x \leq 150000:\\ \;\;\;\;y + x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (or (<= x -9e+183) (and (not (<= x -1.6e+66)) (<= x 150000.0)))
   (+ y x)
   (* y (- x))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if ((x <= -9e+183) || (!(x <= -1.6e+66) && (x <= 150000.0))) {
		tmp = y + x;
	} else {
		tmp = y * -x;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((x <= (-9d+183)) .or. (.not. (x <= (-1.6d+66))) .and. (x <= 150000.0d0)) then
        tmp = y + x
    else
        tmp = y * -x
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if ((x <= -9e+183) || (!(x <= -1.6e+66) && (x <= 150000.0))) {
		tmp = y + x;
	} else {
		tmp = y * -x;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if (x <= -9e+183) or (not (x <= -1.6e+66) and (x <= 150000.0)):
		tmp = y + x
	else:
		tmp = y * -x
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if ((x <= -9e+183) || (!(x <= -1.6e+66) && (x <= 150000.0)))
		tmp = Float64(y + x);
	else
		tmp = Float64(y * Float64(-x));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((x <= -9e+183) || (~((x <= -1.6e+66)) && (x <= 150000.0)))
		tmp = y + x;
	else
		tmp = y * -x;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[Or[LessEqual[x, -9e+183], And[N[Not[LessEqual[x, -1.6e+66]], $MachinePrecision], LessEqual[x, 150000.0]]], N[(y + x), $MachinePrecision], N[(y * (-x)), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{+183} \lor \neg \left(x \leq -1.6 \cdot 10^{+66}\right) \land x \leq 150000:\\
\;\;\;\;y + x\\

\mathbf{else}:\\
\;\;\;\;y \cdot \left(-x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -9.00000000000000034e183 or -1.6e66 < x < 1.5e5

    1. Initial program 100.0%

      \[\left(x + y\right) - x \cdot y \]
    2. Step-by-step derivation
      1. associate--l+100.0%

        \[\leadsto \color{blue}{x + \left(y - x \cdot y\right)} \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(y - x \cdot y\right) + x} \]
      3. remove-double-neg100.0%

        \[\leadsto \left(y - x \cdot y\right) + \color{blue}{\left(-\left(-x\right)\right)} \]
      4. unsub-neg100.0%

        \[\leadsto \color{blue}{\left(y - x \cdot y\right) - \left(-x\right)} \]
      5. cancel-sign-sub-inv100.0%

        \[\leadsto \color{blue}{\left(y + \left(-x\right) \cdot y\right)} - \left(-x\right) \]
      6. associate--l+100.0%

        \[\leadsto \color{blue}{y + \left(\left(-x\right) \cdot y - \left(-x\right)\right)} \]
      7. neg-mul-1100.0%

        \[\leadsto y + \left(\left(-x\right) \cdot y - \color{blue}{-1 \cdot x}\right) \]
      8. cancel-sign-sub-inv100.0%

        \[\leadsto y + \color{blue}{\left(\left(-x\right) \cdot y + \left(--1\right) \cdot x\right)} \]
      9. distribute-lft-neg-out100.0%

        \[\leadsto y + \left(\color{blue}{\left(-x \cdot y\right)} + \left(--1\right) \cdot x\right) \]
      10. distribute-rgt-neg-out100.0%

        \[\leadsto y + \left(\color{blue}{x \cdot \left(-y\right)} + \left(--1\right) \cdot x\right) \]
      11. *-commutative100.0%

        \[\leadsto y + \left(\color{blue}{\left(-y\right) \cdot x} + \left(--1\right) \cdot x\right) \]
      12. distribute-rgt-out100.0%

        \[\leadsto y + \color{blue}{x \cdot \left(\left(-y\right) + \left(--1\right)\right)} \]
      13. +-commutative100.0%

        \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) + \left(-y\right)\right)} \]
      14. sub-neg100.0%

        \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) - y\right)} \]
      15. metadata-eval100.0%

        \[\leadsto y + x \cdot \left(\color{blue}{1} - y\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{y + x \cdot \left(1 - y\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 89.9%

      \[\leadsto y + \color{blue}{x} \]

    if -9.00000000000000034e183 < x < -1.6e66 or 1.5e5 < x

    1. Initial program 100.0%

      \[\left(x + y\right) - x \cdot y \]
    2. Step-by-step derivation
      1. associate--l+100.0%

        \[\leadsto \color{blue}{x + \left(y - x \cdot y\right)} \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(y - x \cdot y\right) + x} \]
      3. remove-double-neg100.0%

        \[\leadsto \left(y - x \cdot y\right) + \color{blue}{\left(-\left(-x\right)\right)} \]
      4. unsub-neg100.0%

        \[\leadsto \color{blue}{\left(y - x \cdot y\right) - \left(-x\right)} \]
      5. cancel-sign-sub-inv100.0%

        \[\leadsto \color{blue}{\left(y + \left(-x\right) \cdot y\right)} - \left(-x\right) \]
      6. associate--l+100.0%

        \[\leadsto \color{blue}{y + \left(\left(-x\right) \cdot y - \left(-x\right)\right)} \]
      7. neg-mul-1100.0%

        \[\leadsto y + \left(\left(-x\right) \cdot y - \color{blue}{-1 \cdot x}\right) \]
      8. cancel-sign-sub-inv100.0%

        \[\leadsto y + \color{blue}{\left(\left(-x\right) \cdot y + \left(--1\right) \cdot x\right)} \]
      9. distribute-lft-neg-out100.0%

        \[\leadsto y + \left(\color{blue}{\left(-x \cdot y\right)} + \left(--1\right) \cdot x\right) \]
      10. distribute-rgt-neg-out100.0%

        \[\leadsto y + \left(\color{blue}{x \cdot \left(-y\right)} + \left(--1\right) \cdot x\right) \]
      11. *-commutative100.0%

        \[\leadsto y + \left(\color{blue}{\left(-y\right) \cdot x} + \left(--1\right) \cdot x\right) \]
      12. distribute-rgt-out100.0%

        \[\leadsto y + \color{blue}{x \cdot \left(\left(-y\right) + \left(--1\right)\right)} \]
      13. +-commutative100.0%

        \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) + \left(-y\right)\right)} \]
      14. sub-neg100.0%

        \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) - y\right)} \]
      15. metadata-eval100.0%

        \[\leadsto y + x \cdot \left(\color{blue}{1} - y\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{y + x \cdot \left(1 - y\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 54.3%

      \[\leadsto \color{blue}{y \cdot \left(1 + -1 \cdot x\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg54.3%

        \[\leadsto y \cdot \left(1 + \color{blue}{\left(-x\right)}\right) \]
      2. unsub-neg54.3%

        \[\leadsto y \cdot \color{blue}{\left(1 - x\right)} \]
    7. Simplified54.3%

      \[\leadsto \color{blue}{y \cdot \left(1 - x\right)} \]
    8. Taylor expanded in x around inf 53.5%

      \[\leadsto y \cdot \color{blue}{\left(-1 \cdot x\right)} \]
    9. Step-by-step derivation
      1. mul-1-neg53.5%

        \[\leadsto y \cdot \color{blue}{\left(-x\right)} \]
    10. Simplified53.5%

      \[\leadsto y \cdot \color{blue}{\left(-x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification75.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -9 \cdot 10^{+183} \lor \neg \left(x \leq -1.6 \cdot 10^{+66}\right) \land x \leq 150000:\\ \;\;\;\;y + x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 99.0% accurate, 0.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -6.2 \cdot 10^{+16}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;x \leq 3 \cdot 10^{-27}:\\ \;\;\;\;y + x\\ \mathbf{else}:\\ \;\;\;\;y - y \cdot x\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -6.2e+16) (* x (- 1.0 y)) (if (<= x 3e-27) (+ y x) (- y (* y x)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -6.2e+16) {
		tmp = x * (1.0 - y);
	} else if (x <= 3e-27) {
		tmp = y + x;
	} else {
		tmp = y - (y * x);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-6.2d+16)) then
        tmp = x * (1.0d0 - y)
    else if (x <= 3d-27) then
        tmp = y + x
    else
        tmp = y - (y * x)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -6.2e+16) {
		tmp = x * (1.0 - y);
	} else if (x <= 3e-27) {
		tmp = y + x;
	} else {
		tmp = y - (y * x);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -6.2e+16:
		tmp = x * (1.0 - y)
	elif x <= 3e-27:
		tmp = y + x
	else:
		tmp = y - (y * x)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -6.2e+16)
		tmp = Float64(x * Float64(1.0 - y));
	elseif (x <= 3e-27)
		tmp = Float64(y + x);
	else
		tmp = Float64(y - Float64(y * x));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -6.2e+16)
		tmp = x * (1.0 - y);
	elseif (x <= 3e-27)
		tmp = y + x;
	else
		tmp = y - (y * x);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, -6.2e+16], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3e-27], N[(y + x), $MachinePrecision], N[(y - N[(y * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.2 \cdot 10^{+16}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\

\mathbf{elif}\;x \leq 3 \cdot 10^{-27}:\\
\;\;\;\;y + x\\

\mathbf{else}:\\
\;\;\;\;y - y \cdot x\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -6.2e16

    1. Initial program 99.9%

      \[\left(x + y\right) - x \cdot y \]
    2. Step-by-step derivation
      1. associate--l+99.9%

        \[\leadsto \color{blue}{x + \left(y - x \cdot y\right)} \]
      2. +-commutative99.9%

        \[\leadsto \color{blue}{\left(y - x \cdot y\right) + x} \]
      3. remove-double-neg99.9%

        \[\leadsto \left(y - x \cdot y\right) + \color{blue}{\left(-\left(-x\right)\right)} \]
      4. unsub-neg99.9%

        \[\leadsto \color{blue}{\left(y - x \cdot y\right) - \left(-x\right)} \]
      5. cancel-sign-sub-inv99.9%

        \[\leadsto \color{blue}{\left(y + \left(-x\right) \cdot y\right)} - \left(-x\right) \]
      6. associate--l+99.9%

        \[\leadsto \color{blue}{y + \left(\left(-x\right) \cdot y - \left(-x\right)\right)} \]
      7. neg-mul-199.9%

        \[\leadsto y + \left(\left(-x\right) \cdot y - \color{blue}{-1 \cdot x}\right) \]
      8. cancel-sign-sub-inv99.9%

        \[\leadsto y + \color{blue}{\left(\left(-x\right) \cdot y + \left(--1\right) \cdot x\right)} \]
      9. distribute-lft-neg-out99.9%

        \[\leadsto y + \left(\color{blue}{\left(-x \cdot y\right)} + \left(--1\right) \cdot x\right) \]
      10. distribute-rgt-neg-out99.9%

        \[\leadsto y + \left(\color{blue}{x \cdot \left(-y\right)} + \left(--1\right) \cdot x\right) \]
      11. *-commutative99.9%

        \[\leadsto y + \left(\color{blue}{\left(-y\right) \cdot x} + \left(--1\right) \cdot x\right) \]
      12. distribute-rgt-out100.0%

        \[\leadsto y + \color{blue}{x \cdot \left(\left(-y\right) + \left(--1\right)\right)} \]
      13. +-commutative100.0%

        \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) + \left(-y\right)\right)} \]
      14. sub-neg100.0%

        \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) - y\right)} \]
      15. metadata-eval100.0%

        \[\leadsto y + x \cdot \left(\color{blue}{1} - y\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{y + x \cdot \left(1 - y\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 99.9%

      \[\leadsto \color{blue}{x + y \cdot \left(1 + -1 \cdot x\right)} \]
    6. Step-by-step derivation
      1. +-commutative99.9%

        \[\leadsto \color{blue}{y \cdot \left(1 + -1 \cdot x\right) + x} \]
      2. fma-define100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1 + -1 \cdot x, x\right)} \]
      3. mul-1-neg100.0%

        \[\leadsto \mathsf{fma}\left(y, 1 + \color{blue}{\left(-x\right)}, x\right) \]
      4. unsub-neg100.0%

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{1 - x}, x\right) \]
    7. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1 - x, x\right)} \]
    8. Taylor expanded in x around inf 100.0%

      \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot y\right)} \]
    9. Step-by-step derivation
      1. neg-mul-1100.0%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-y\right)}\right) \]
      2. unsub-neg100.0%

        \[\leadsto x \cdot \color{blue}{\left(1 - y\right)} \]
    10. Simplified100.0%

      \[\leadsto \color{blue}{x \cdot \left(1 - y\right)} \]

    if -6.2e16 < x < 3.0000000000000001e-27

    1. Initial program 100.0%

      \[\left(x + y\right) - x \cdot y \]
    2. Step-by-step derivation
      1. associate--l+100.0%

        \[\leadsto \color{blue}{x + \left(y - x \cdot y\right)} \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(y - x \cdot y\right) + x} \]
      3. remove-double-neg100.0%

        \[\leadsto \left(y - x \cdot y\right) + \color{blue}{\left(-\left(-x\right)\right)} \]
      4. unsub-neg100.0%

        \[\leadsto \color{blue}{\left(y - x \cdot y\right) - \left(-x\right)} \]
      5. cancel-sign-sub-inv100.0%

        \[\leadsto \color{blue}{\left(y + \left(-x\right) \cdot y\right)} - \left(-x\right) \]
      6. associate--l+100.0%

        \[\leadsto \color{blue}{y + \left(\left(-x\right) \cdot y - \left(-x\right)\right)} \]
      7. neg-mul-1100.0%

        \[\leadsto y + \left(\left(-x\right) \cdot y - \color{blue}{-1 \cdot x}\right) \]
      8. cancel-sign-sub-inv100.0%

        \[\leadsto y + \color{blue}{\left(\left(-x\right) \cdot y + \left(--1\right) \cdot x\right)} \]
      9. distribute-lft-neg-out100.0%

        \[\leadsto y + \left(\color{blue}{\left(-x \cdot y\right)} + \left(--1\right) \cdot x\right) \]
      10. distribute-rgt-neg-out100.0%

        \[\leadsto y + \left(\color{blue}{x \cdot \left(-y\right)} + \left(--1\right) \cdot x\right) \]
      11. *-commutative100.0%

        \[\leadsto y + \left(\color{blue}{\left(-y\right) \cdot x} + \left(--1\right) \cdot x\right) \]
      12. distribute-rgt-out100.0%

        \[\leadsto y + \color{blue}{x \cdot \left(\left(-y\right) + \left(--1\right)\right)} \]
      13. +-commutative100.0%

        \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) + \left(-y\right)\right)} \]
      14. sub-neg100.0%

        \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) - y\right)} \]
      15. metadata-eval100.0%

        \[\leadsto y + x \cdot \left(\color{blue}{1} - y\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{y + x \cdot \left(1 - y\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 98.7%

      \[\leadsto y + \color{blue}{x} \]

    if 3.0000000000000001e-27 < x

    1. Initial program 100.0%

      \[\left(x + y\right) - x \cdot y \]
    2. Step-by-step derivation
      1. associate--l+100.0%

        \[\leadsto \color{blue}{x + \left(y - x \cdot y\right)} \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(y - x \cdot y\right) + x} \]
      3. remove-double-neg100.0%

        \[\leadsto \left(y - x \cdot y\right) + \color{blue}{\left(-\left(-x\right)\right)} \]
      4. unsub-neg100.0%

        \[\leadsto \color{blue}{\left(y - x \cdot y\right) - \left(-x\right)} \]
      5. cancel-sign-sub-inv100.0%

        \[\leadsto \color{blue}{\left(y + \left(-x\right) \cdot y\right)} - \left(-x\right) \]
      6. associate--l+100.0%

        \[\leadsto \color{blue}{y + \left(\left(-x\right) \cdot y - \left(-x\right)\right)} \]
      7. neg-mul-1100.0%

        \[\leadsto y + \left(\left(-x\right) \cdot y - \color{blue}{-1 \cdot x}\right) \]
      8. cancel-sign-sub-inv100.0%

        \[\leadsto y + \color{blue}{\left(\left(-x\right) \cdot y + \left(--1\right) \cdot x\right)} \]
      9. distribute-lft-neg-out100.0%

        \[\leadsto y + \left(\color{blue}{\left(-x \cdot y\right)} + \left(--1\right) \cdot x\right) \]
      10. distribute-rgt-neg-out100.0%

        \[\leadsto y + \left(\color{blue}{x \cdot \left(-y\right)} + \left(--1\right) \cdot x\right) \]
      11. *-commutative100.0%

        \[\leadsto y + \left(\color{blue}{\left(-y\right) \cdot x} + \left(--1\right) \cdot x\right) \]
      12. distribute-rgt-out100.0%

        \[\leadsto y + \color{blue}{x \cdot \left(\left(-y\right) + \left(--1\right)\right)} \]
      13. +-commutative100.0%

        \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) + \left(-y\right)\right)} \]
      14. sub-neg100.0%

        \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) - y\right)} \]
      15. metadata-eval100.0%

        \[\leadsto y + x \cdot \left(\color{blue}{1} - y\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{y + x \cdot \left(1 - y\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 49.5%

      \[\leadsto \color{blue}{y \cdot \left(1 + -1 \cdot x\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg49.5%

        \[\leadsto y \cdot \left(1 + \color{blue}{\left(-x\right)}\right) \]
      2. unsub-neg49.5%

        \[\leadsto y \cdot \color{blue}{\left(1 - x\right)} \]
    7. Simplified49.5%

      \[\leadsto \color{blue}{y \cdot \left(1 - x\right)} \]
    8. Step-by-step derivation
      1. sub-neg49.5%

        \[\leadsto y \cdot \color{blue}{\left(1 + \left(-x\right)\right)} \]
      2. distribute-rgt-in49.5%

        \[\leadsto \color{blue}{1 \cdot y + \left(-x\right) \cdot y} \]
      3. *-un-lft-identity49.5%

        \[\leadsto \color{blue}{y} + \left(-x\right) \cdot y \]
      4. *-commutative49.5%

        \[\leadsto y + \color{blue}{y \cdot \left(-x\right)} \]
      5. distribute-rgt-neg-out49.5%

        \[\leadsto y + \color{blue}{\left(-y \cdot x\right)} \]
      6. unsub-neg49.5%

        \[\leadsto \color{blue}{y - y \cdot x} \]
    9. Applied egg-rr49.5%

      \[\leadsto \color{blue}{y - y \cdot x} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 4: 99.0% accurate, 0.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -6.2 \cdot 10^{+16}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;x \leq 3 \cdot 10^{-27}:\\ \;\;\;\;y + x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(1 - x\right)\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -6.2e+16)
   (* x (- 1.0 y))
   (if (<= x 3e-27) (+ y x) (* y (- 1.0 x)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -6.2e+16) {
		tmp = x * (1.0 - y);
	} else if (x <= 3e-27) {
		tmp = y + x;
	} else {
		tmp = y * (1.0 - x);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-6.2d+16)) then
        tmp = x * (1.0d0 - y)
    else if (x <= 3d-27) then
        tmp = y + x
    else
        tmp = y * (1.0d0 - x)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -6.2e+16) {
		tmp = x * (1.0 - y);
	} else if (x <= 3e-27) {
		tmp = y + x;
	} else {
		tmp = y * (1.0 - x);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -6.2e+16:
		tmp = x * (1.0 - y)
	elif x <= 3e-27:
		tmp = y + x
	else:
		tmp = y * (1.0 - x)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -6.2e+16)
		tmp = Float64(x * Float64(1.0 - y));
	elseif (x <= 3e-27)
		tmp = Float64(y + x);
	else
		tmp = Float64(y * Float64(1.0 - x));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -6.2e+16)
		tmp = x * (1.0 - y);
	elseif (x <= 3e-27)
		tmp = y + x;
	else
		tmp = y * (1.0 - x);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, -6.2e+16], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3e-27], N[(y + x), $MachinePrecision], N[(y * N[(1.0 - x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.2 \cdot 10^{+16}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\

\mathbf{elif}\;x \leq 3 \cdot 10^{-27}:\\
\;\;\;\;y + x\\

\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -6.2e16

    1. Initial program 99.9%

      \[\left(x + y\right) - x \cdot y \]
    2. Step-by-step derivation
      1. associate--l+99.9%

        \[\leadsto \color{blue}{x + \left(y - x \cdot y\right)} \]
      2. +-commutative99.9%

        \[\leadsto \color{blue}{\left(y - x \cdot y\right) + x} \]
      3. remove-double-neg99.9%

        \[\leadsto \left(y - x \cdot y\right) + \color{blue}{\left(-\left(-x\right)\right)} \]
      4. unsub-neg99.9%

        \[\leadsto \color{blue}{\left(y - x \cdot y\right) - \left(-x\right)} \]
      5. cancel-sign-sub-inv99.9%

        \[\leadsto \color{blue}{\left(y + \left(-x\right) \cdot y\right)} - \left(-x\right) \]
      6. associate--l+99.9%

        \[\leadsto \color{blue}{y + \left(\left(-x\right) \cdot y - \left(-x\right)\right)} \]
      7. neg-mul-199.9%

        \[\leadsto y + \left(\left(-x\right) \cdot y - \color{blue}{-1 \cdot x}\right) \]
      8. cancel-sign-sub-inv99.9%

        \[\leadsto y + \color{blue}{\left(\left(-x\right) \cdot y + \left(--1\right) \cdot x\right)} \]
      9. distribute-lft-neg-out99.9%

        \[\leadsto y + \left(\color{blue}{\left(-x \cdot y\right)} + \left(--1\right) \cdot x\right) \]
      10. distribute-rgt-neg-out99.9%

        \[\leadsto y + \left(\color{blue}{x \cdot \left(-y\right)} + \left(--1\right) \cdot x\right) \]
      11. *-commutative99.9%

        \[\leadsto y + \left(\color{blue}{\left(-y\right) \cdot x} + \left(--1\right) \cdot x\right) \]
      12. distribute-rgt-out100.0%

        \[\leadsto y + \color{blue}{x \cdot \left(\left(-y\right) + \left(--1\right)\right)} \]
      13. +-commutative100.0%

        \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) + \left(-y\right)\right)} \]
      14. sub-neg100.0%

        \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) - y\right)} \]
      15. metadata-eval100.0%

        \[\leadsto y + x \cdot \left(\color{blue}{1} - y\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{y + x \cdot \left(1 - y\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 99.9%

      \[\leadsto \color{blue}{x + y \cdot \left(1 + -1 \cdot x\right)} \]
    6. Step-by-step derivation
      1. +-commutative99.9%

        \[\leadsto \color{blue}{y \cdot \left(1 + -1 \cdot x\right) + x} \]
      2. fma-define100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1 + -1 \cdot x, x\right)} \]
      3. mul-1-neg100.0%

        \[\leadsto \mathsf{fma}\left(y, 1 + \color{blue}{\left(-x\right)}, x\right) \]
      4. unsub-neg100.0%

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{1 - x}, x\right) \]
    7. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1 - x, x\right)} \]
    8. Taylor expanded in x around inf 100.0%

      \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot y\right)} \]
    9. Step-by-step derivation
      1. neg-mul-1100.0%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-y\right)}\right) \]
      2. unsub-neg100.0%

        \[\leadsto x \cdot \color{blue}{\left(1 - y\right)} \]
    10. Simplified100.0%

      \[\leadsto \color{blue}{x \cdot \left(1 - y\right)} \]

    if -6.2e16 < x < 3.0000000000000001e-27

    1. Initial program 100.0%

      \[\left(x + y\right) - x \cdot y \]
    2. Step-by-step derivation
      1. associate--l+100.0%

        \[\leadsto \color{blue}{x + \left(y - x \cdot y\right)} \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(y - x \cdot y\right) + x} \]
      3. remove-double-neg100.0%

        \[\leadsto \left(y - x \cdot y\right) + \color{blue}{\left(-\left(-x\right)\right)} \]
      4. unsub-neg100.0%

        \[\leadsto \color{blue}{\left(y - x \cdot y\right) - \left(-x\right)} \]
      5. cancel-sign-sub-inv100.0%

        \[\leadsto \color{blue}{\left(y + \left(-x\right) \cdot y\right)} - \left(-x\right) \]
      6. associate--l+100.0%

        \[\leadsto \color{blue}{y + \left(\left(-x\right) \cdot y - \left(-x\right)\right)} \]
      7. neg-mul-1100.0%

        \[\leadsto y + \left(\left(-x\right) \cdot y - \color{blue}{-1 \cdot x}\right) \]
      8. cancel-sign-sub-inv100.0%

        \[\leadsto y + \color{blue}{\left(\left(-x\right) \cdot y + \left(--1\right) \cdot x\right)} \]
      9. distribute-lft-neg-out100.0%

        \[\leadsto y + \left(\color{blue}{\left(-x \cdot y\right)} + \left(--1\right) \cdot x\right) \]
      10. distribute-rgt-neg-out100.0%

        \[\leadsto y + \left(\color{blue}{x \cdot \left(-y\right)} + \left(--1\right) \cdot x\right) \]
      11. *-commutative100.0%

        \[\leadsto y + \left(\color{blue}{\left(-y\right) \cdot x} + \left(--1\right) \cdot x\right) \]
      12. distribute-rgt-out100.0%

        \[\leadsto y + \color{blue}{x \cdot \left(\left(-y\right) + \left(--1\right)\right)} \]
      13. +-commutative100.0%

        \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) + \left(-y\right)\right)} \]
      14. sub-neg100.0%

        \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) - y\right)} \]
      15. metadata-eval100.0%

        \[\leadsto y + x \cdot \left(\color{blue}{1} - y\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{y + x \cdot \left(1 - y\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 98.7%

      \[\leadsto y + \color{blue}{x} \]

    if 3.0000000000000001e-27 < x

    1. Initial program 100.0%

      \[\left(x + y\right) - x \cdot y \]
    2. Step-by-step derivation
      1. associate--l+100.0%

        \[\leadsto \color{blue}{x + \left(y - x \cdot y\right)} \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(y - x \cdot y\right) + x} \]
      3. remove-double-neg100.0%

        \[\leadsto \left(y - x \cdot y\right) + \color{blue}{\left(-\left(-x\right)\right)} \]
      4. unsub-neg100.0%

        \[\leadsto \color{blue}{\left(y - x \cdot y\right) - \left(-x\right)} \]
      5. cancel-sign-sub-inv100.0%

        \[\leadsto \color{blue}{\left(y + \left(-x\right) \cdot y\right)} - \left(-x\right) \]
      6. associate--l+100.0%

        \[\leadsto \color{blue}{y + \left(\left(-x\right) \cdot y - \left(-x\right)\right)} \]
      7. neg-mul-1100.0%

        \[\leadsto y + \left(\left(-x\right) \cdot y - \color{blue}{-1 \cdot x}\right) \]
      8. cancel-sign-sub-inv100.0%

        \[\leadsto y + \color{blue}{\left(\left(-x\right) \cdot y + \left(--1\right) \cdot x\right)} \]
      9. distribute-lft-neg-out100.0%

        \[\leadsto y + \left(\color{blue}{\left(-x \cdot y\right)} + \left(--1\right) \cdot x\right) \]
      10. distribute-rgt-neg-out100.0%

        \[\leadsto y + \left(\color{blue}{x \cdot \left(-y\right)} + \left(--1\right) \cdot x\right) \]
      11. *-commutative100.0%

        \[\leadsto y + \left(\color{blue}{\left(-y\right) \cdot x} + \left(--1\right) \cdot x\right) \]
      12. distribute-rgt-out100.0%

        \[\leadsto y + \color{blue}{x \cdot \left(\left(-y\right) + \left(--1\right)\right)} \]
      13. +-commutative100.0%

        \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) + \left(-y\right)\right)} \]
      14. sub-neg100.0%

        \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) - y\right)} \]
      15. metadata-eval100.0%

        \[\leadsto y + x \cdot \left(\color{blue}{1} - y\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{y + x \cdot \left(1 - y\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 49.5%

      \[\leadsto \color{blue}{y \cdot \left(1 + -1 \cdot x\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg49.5%

        \[\leadsto y \cdot \left(1 + \color{blue}{\left(-x\right)}\right) \]
      2. unsub-neg49.5%

        \[\leadsto y \cdot \color{blue}{\left(1 - x\right)} \]
    7. Simplified49.5%

      \[\leadsto \color{blue}{y \cdot \left(1 - x\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 5: 98.4% accurate, 0.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -6.2 \cdot 10^{+16}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;x \leq 240000:\\ \;\;\;\;y + x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -6.2e+16) (* x (- 1.0 y)) (if (<= x 240000.0) (+ y x) (* y (- x)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -6.2e+16) {
		tmp = x * (1.0 - y);
	} else if (x <= 240000.0) {
		tmp = y + x;
	} else {
		tmp = y * -x;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-6.2d+16)) then
        tmp = x * (1.0d0 - y)
    else if (x <= 240000.0d0) then
        tmp = y + x
    else
        tmp = y * -x
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -6.2e+16) {
		tmp = x * (1.0 - y);
	} else if (x <= 240000.0) {
		tmp = y + x;
	} else {
		tmp = y * -x;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -6.2e+16:
		tmp = x * (1.0 - y)
	elif x <= 240000.0:
		tmp = y + x
	else:
		tmp = y * -x
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -6.2e+16)
		tmp = Float64(x * Float64(1.0 - y));
	elseif (x <= 240000.0)
		tmp = Float64(y + x);
	else
		tmp = Float64(y * Float64(-x));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -6.2e+16)
		tmp = x * (1.0 - y);
	elseif (x <= 240000.0)
		tmp = y + x;
	else
		tmp = y * -x;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, -6.2e+16], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 240000.0], N[(y + x), $MachinePrecision], N[(y * (-x)), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.2 \cdot 10^{+16}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\

\mathbf{elif}\;x \leq 240000:\\
\;\;\;\;y + x\\

\mathbf{else}:\\
\;\;\;\;y \cdot \left(-x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -6.2e16

    1. Initial program 99.9%

      \[\left(x + y\right) - x \cdot y \]
    2. Step-by-step derivation
      1. associate--l+99.9%

        \[\leadsto \color{blue}{x + \left(y - x \cdot y\right)} \]
      2. +-commutative99.9%

        \[\leadsto \color{blue}{\left(y - x \cdot y\right) + x} \]
      3. remove-double-neg99.9%

        \[\leadsto \left(y - x \cdot y\right) + \color{blue}{\left(-\left(-x\right)\right)} \]
      4. unsub-neg99.9%

        \[\leadsto \color{blue}{\left(y - x \cdot y\right) - \left(-x\right)} \]
      5. cancel-sign-sub-inv99.9%

        \[\leadsto \color{blue}{\left(y + \left(-x\right) \cdot y\right)} - \left(-x\right) \]
      6. associate--l+99.9%

        \[\leadsto \color{blue}{y + \left(\left(-x\right) \cdot y - \left(-x\right)\right)} \]
      7. neg-mul-199.9%

        \[\leadsto y + \left(\left(-x\right) \cdot y - \color{blue}{-1 \cdot x}\right) \]
      8. cancel-sign-sub-inv99.9%

        \[\leadsto y + \color{blue}{\left(\left(-x\right) \cdot y + \left(--1\right) \cdot x\right)} \]
      9. distribute-lft-neg-out99.9%

        \[\leadsto y + \left(\color{blue}{\left(-x \cdot y\right)} + \left(--1\right) \cdot x\right) \]
      10. distribute-rgt-neg-out99.9%

        \[\leadsto y + \left(\color{blue}{x \cdot \left(-y\right)} + \left(--1\right) \cdot x\right) \]
      11. *-commutative99.9%

        \[\leadsto y + \left(\color{blue}{\left(-y\right) \cdot x} + \left(--1\right) \cdot x\right) \]
      12. distribute-rgt-out100.0%

        \[\leadsto y + \color{blue}{x \cdot \left(\left(-y\right) + \left(--1\right)\right)} \]
      13. +-commutative100.0%

        \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) + \left(-y\right)\right)} \]
      14. sub-neg100.0%

        \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) - y\right)} \]
      15. metadata-eval100.0%

        \[\leadsto y + x \cdot \left(\color{blue}{1} - y\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{y + x \cdot \left(1 - y\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 99.9%

      \[\leadsto \color{blue}{x + y \cdot \left(1 + -1 \cdot x\right)} \]
    6. Step-by-step derivation
      1. +-commutative99.9%

        \[\leadsto \color{blue}{y \cdot \left(1 + -1 \cdot x\right) + x} \]
      2. fma-define100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1 + -1 \cdot x, x\right)} \]
      3. mul-1-neg100.0%

        \[\leadsto \mathsf{fma}\left(y, 1 + \color{blue}{\left(-x\right)}, x\right) \]
      4. unsub-neg100.0%

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{1 - x}, x\right) \]
    7. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1 - x, x\right)} \]
    8. Taylor expanded in x around inf 100.0%

      \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot y\right)} \]
    9. Step-by-step derivation
      1. neg-mul-1100.0%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-y\right)}\right) \]
      2. unsub-neg100.0%

        \[\leadsto x \cdot \color{blue}{\left(1 - y\right)} \]
    10. Simplified100.0%

      \[\leadsto \color{blue}{x \cdot \left(1 - y\right)} \]

    if -6.2e16 < x < 2.4e5

    1. Initial program 100.0%

      \[\left(x + y\right) - x \cdot y \]
    2. Step-by-step derivation
      1. associate--l+100.0%

        \[\leadsto \color{blue}{x + \left(y - x \cdot y\right)} \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(y - x \cdot y\right) + x} \]
      3. remove-double-neg100.0%

        \[\leadsto \left(y - x \cdot y\right) + \color{blue}{\left(-\left(-x\right)\right)} \]
      4. unsub-neg100.0%

        \[\leadsto \color{blue}{\left(y - x \cdot y\right) - \left(-x\right)} \]
      5. cancel-sign-sub-inv100.0%

        \[\leadsto \color{blue}{\left(y + \left(-x\right) \cdot y\right)} - \left(-x\right) \]
      6. associate--l+100.0%

        \[\leadsto \color{blue}{y + \left(\left(-x\right) \cdot y - \left(-x\right)\right)} \]
      7. neg-mul-1100.0%

        \[\leadsto y + \left(\left(-x\right) \cdot y - \color{blue}{-1 \cdot x}\right) \]
      8. cancel-sign-sub-inv100.0%

        \[\leadsto y + \color{blue}{\left(\left(-x\right) \cdot y + \left(--1\right) \cdot x\right)} \]
      9. distribute-lft-neg-out100.0%

        \[\leadsto y + \left(\color{blue}{\left(-x \cdot y\right)} + \left(--1\right) \cdot x\right) \]
      10. distribute-rgt-neg-out100.0%

        \[\leadsto y + \left(\color{blue}{x \cdot \left(-y\right)} + \left(--1\right) \cdot x\right) \]
      11. *-commutative100.0%

        \[\leadsto y + \left(\color{blue}{\left(-y\right) \cdot x} + \left(--1\right) \cdot x\right) \]
      12. distribute-rgt-out100.0%

        \[\leadsto y + \color{blue}{x \cdot \left(\left(-y\right) + \left(--1\right)\right)} \]
      13. +-commutative100.0%

        \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) + \left(-y\right)\right)} \]
      14. sub-neg100.0%

        \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) - y\right)} \]
      15. metadata-eval100.0%

        \[\leadsto y + x \cdot \left(\color{blue}{1} - y\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{y + x \cdot \left(1 - y\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 96.6%

      \[\leadsto y + \color{blue}{x} \]

    if 2.4e5 < x

    1. Initial program 100.0%

      \[\left(x + y\right) - x \cdot y \]
    2. Step-by-step derivation
      1. associate--l+100.0%

        \[\leadsto \color{blue}{x + \left(y - x \cdot y\right)} \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(y - x \cdot y\right) + x} \]
      3. remove-double-neg100.0%

        \[\leadsto \left(y - x \cdot y\right) + \color{blue}{\left(-\left(-x\right)\right)} \]
      4. unsub-neg100.0%

        \[\leadsto \color{blue}{\left(y - x \cdot y\right) - \left(-x\right)} \]
      5. cancel-sign-sub-inv100.0%

        \[\leadsto \color{blue}{\left(y + \left(-x\right) \cdot y\right)} - \left(-x\right) \]
      6. associate--l+100.0%

        \[\leadsto \color{blue}{y + \left(\left(-x\right) \cdot y - \left(-x\right)\right)} \]
      7. neg-mul-1100.0%

        \[\leadsto y + \left(\left(-x\right) \cdot y - \color{blue}{-1 \cdot x}\right) \]
      8. cancel-sign-sub-inv100.0%

        \[\leadsto y + \color{blue}{\left(\left(-x\right) \cdot y + \left(--1\right) \cdot x\right)} \]
      9. distribute-lft-neg-out100.0%

        \[\leadsto y + \left(\color{blue}{\left(-x \cdot y\right)} + \left(--1\right) \cdot x\right) \]
      10. distribute-rgt-neg-out100.0%

        \[\leadsto y + \left(\color{blue}{x \cdot \left(-y\right)} + \left(--1\right) \cdot x\right) \]
      11. *-commutative100.0%

        \[\leadsto y + \left(\color{blue}{\left(-y\right) \cdot x} + \left(--1\right) \cdot x\right) \]
      12. distribute-rgt-out100.0%

        \[\leadsto y + \color{blue}{x \cdot \left(\left(-y\right) + \left(--1\right)\right)} \]
      13. +-commutative100.0%

        \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) + \left(-y\right)\right)} \]
      14. sub-neg100.0%

        \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) - y\right)} \]
      15. metadata-eval100.0%

        \[\leadsto y + x \cdot \left(\color{blue}{1} - y\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{y + x \cdot \left(1 - y\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 47.6%

      \[\leadsto \color{blue}{y \cdot \left(1 + -1 \cdot x\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg47.6%

        \[\leadsto y \cdot \left(1 + \color{blue}{\left(-x\right)}\right) \]
      2. unsub-neg47.6%

        \[\leadsto y \cdot \color{blue}{\left(1 - x\right)} \]
    7. Simplified47.6%

      \[\leadsto \color{blue}{y \cdot \left(1 - x\right)} \]
    8. Taylor expanded in x around inf 46.6%

      \[\leadsto y \cdot \color{blue}{\left(-1 \cdot x\right)} \]
    9. Step-by-step derivation
      1. mul-1-neg46.6%

        \[\leadsto y \cdot \color{blue}{\left(-x\right)} \]
    10. Simplified46.6%

      \[\leadsto y \cdot \color{blue}{\left(-x\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 6: 63.5% accurate, 1.2× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 2.35 \cdot 10^{-27}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 (if (<= y 2.35e-27) x y))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 2.35e-27) {
		tmp = x;
	} else {
		tmp = y;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 2.35d-27) then
        tmp = x
    else
        tmp = y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (y <= 2.35e-27) {
		tmp = x;
	} else {
		tmp = y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= 2.35e-27:
		tmp = x
	else:
		tmp = y
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= 2.35e-27)
		tmp = x;
	else
		tmp = y;
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 2.35e-27)
		tmp = x;
	else
		tmp = y;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[y, 2.35e-27], x, y]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.35 \cdot 10^{-27}:\\
\;\;\;\;x\\

\mathbf{else}:\\
\;\;\;\;y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 2.35000000000000016e-27

    1. Initial program 100.0%

      \[\left(x + y\right) - x \cdot y \]
    2. Step-by-step derivation
      1. associate--l+100.0%

        \[\leadsto \color{blue}{x + \left(y - x \cdot y\right)} \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(y - x \cdot y\right) + x} \]
      3. remove-double-neg100.0%

        \[\leadsto \left(y - x \cdot y\right) + \color{blue}{\left(-\left(-x\right)\right)} \]
      4. unsub-neg100.0%

        \[\leadsto \color{blue}{\left(y - x \cdot y\right) - \left(-x\right)} \]
      5. cancel-sign-sub-inv100.0%

        \[\leadsto \color{blue}{\left(y + \left(-x\right) \cdot y\right)} - \left(-x\right) \]
      6. associate--l+100.0%

        \[\leadsto \color{blue}{y + \left(\left(-x\right) \cdot y - \left(-x\right)\right)} \]
      7. neg-mul-1100.0%

        \[\leadsto y + \left(\left(-x\right) \cdot y - \color{blue}{-1 \cdot x}\right) \]
      8. cancel-sign-sub-inv100.0%

        \[\leadsto y + \color{blue}{\left(\left(-x\right) \cdot y + \left(--1\right) \cdot x\right)} \]
      9. distribute-lft-neg-out100.0%

        \[\leadsto y + \left(\color{blue}{\left(-x \cdot y\right)} + \left(--1\right) \cdot x\right) \]
      10. distribute-rgt-neg-out100.0%

        \[\leadsto y + \left(\color{blue}{x \cdot \left(-y\right)} + \left(--1\right) \cdot x\right) \]
      11. *-commutative100.0%

        \[\leadsto y + \left(\color{blue}{\left(-y\right) \cdot x} + \left(--1\right) \cdot x\right) \]
      12. distribute-rgt-out100.0%

        \[\leadsto y + \color{blue}{x \cdot \left(\left(-y\right) + \left(--1\right)\right)} \]
      13. +-commutative100.0%

        \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) + \left(-y\right)\right)} \]
      14. sub-neg100.0%

        \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) - y\right)} \]
      15. metadata-eval100.0%

        \[\leadsto y + x \cdot \left(\color{blue}{1} - y\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{y + x \cdot \left(1 - y\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 100.0%

      \[\leadsto \color{blue}{x + y \cdot \left(1 + -1 \cdot x\right)} \]
    6. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{y \cdot \left(1 + -1 \cdot x\right) + x} \]
      2. fma-define100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1 + -1 \cdot x, x\right)} \]
      3. mul-1-neg100.0%

        \[\leadsto \mathsf{fma}\left(y, 1 + \color{blue}{\left(-x\right)}, x\right) \]
      4. unsub-neg100.0%

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{1 - x}, x\right) \]
    7. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1 - x, x\right)} \]
    8. Taylor expanded in y around 0 50.9%

      \[\leadsto \color{blue}{x} \]

    if 2.35000000000000016e-27 < y

    1. Initial program 100.0%

      \[\left(x + y\right) - x \cdot y \]
    2. Step-by-step derivation
      1. associate--l+100.0%

        \[\leadsto \color{blue}{x + \left(y - x \cdot y\right)} \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(y - x \cdot y\right) + x} \]
      3. remove-double-neg100.0%

        \[\leadsto \left(y - x \cdot y\right) + \color{blue}{\left(-\left(-x\right)\right)} \]
      4. unsub-neg100.0%

        \[\leadsto \color{blue}{\left(y - x \cdot y\right) - \left(-x\right)} \]
      5. cancel-sign-sub-inv100.0%

        \[\leadsto \color{blue}{\left(y + \left(-x\right) \cdot y\right)} - \left(-x\right) \]
      6. associate--l+100.0%

        \[\leadsto \color{blue}{y + \left(\left(-x\right) \cdot y - \left(-x\right)\right)} \]
      7. neg-mul-1100.0%

        \[\leadsto y + \left(\left(-x\right) \cdot y - \color{blue}{-1 \cdot x}\right) \]
      8. cancel-sign-sub-inv100.0%

        \[\leadsto y + \color{blue}{\left(\left(-x\right) \cdot y + \left(--1\right) \cdot x\right)} \]
      9. distribute-lft-neg-out100.0%

        \[\leadsto y + \left(\color{blue}{\left(-x \cdot y\right)} + \left(--1\right) \cdot x\right) \]
      10. distribute-rgt-neg-out100.0%

        \[\leadsto y + \left(\color{blue}{x \cdot \left(-y\right)} + \left(--1\right) \cdot x\right) \]
      11. *-commutative100.0%

        \[\leadsto y + \left(\color{blue}{\left(-y\right) \cdot x} + \left(--1\right) \cdot x\right) \]
      12. distribute-rgt-out100.0%

        \[\leadsto y + \color{blue}{x \cdot \left(\left(-y\right) + \left(--1\right)\right)} \]
      13. +-commutative100.0%

        \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) + \left(-y\right)\right)} \]
      14. sub-neg100.0%

        \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) - y\right)} \]
      15. metadata-eval100.0%

        \[\leadsto y + x \cdot \left(\color{blue}{1} - y\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{y + x \cdot \left(1 - y\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 44.2%

      \[\leadsto \color{blue}{y} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 74.8% accurate, 2.3× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ y + x \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 (+ y x))
assert(x < y);
double code(double x, double y) {
	return y + x;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = y + x
end function
assert x < y;
public static double code(double x, double y) {
	return y + x;
}
[x, y] = sort([x, y])
def code(x, y):
	return y + x
x, y = sort([x, y])
function code(x, y)
	return Float64(y + x)
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = y + x;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := N[(y + x), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
y + x
\end{array}
Derivation
  1. Initial program 100.0%

    \[\left(x + y\right) - x \cdot y \]
  2. Step-by-step derivation
    1. associate--l+100.0%

      \[\leadsto \color{blue}{x + \left(y - x \cdot y\right)} \]
    2. +-commutative100.0%

      \[\leadsto \color{blue}{\left(y - x \cdot y\right) + x} \]
    3. remove-double-neg100.0%

      \[\leadsto \left(y - x \cdot y\right) + \color{blue}{\left(-\left(-x\right)\right)} \]
    4. unsub-neg100.0%

      \[\leadsto \color{blue}{\left(y - x \cdot y\right) - \left(-x\right)} \]
    5. cancel-sign-sub-inv100.0%

      \[\leadsto \color{blue}{\left(y + \left(-x\right) \cdot y\right)} - \left(-x\right) \]
    6. associate--l+100.0%

      \[\leadsto \color{blue}{y + \left(\left(-x\right) \cdot y - \left(-x\right)\right)} \]
    7. neg-mul-1100.0%

      \[\leadsto y + \left(\left(-x\right) \cdot y - \color{blue}{-1 \cdot x}\right) \]
    8. cancel-sign-sub-inv100.0%

      \[\leadsto y + \color{blue}{\left(\left(-x\right) \cdot y + \left(--1\right) \cdot x\right)} \]
    9. distribute-lft-neg-out100.0%

      \[\leadsto y + \left(\color{blue}{\left(-x \cdot y\right)} + \left(--1\right) \cdot x\right) \]
    10. distribute-rgt-neg-out100.0%

      \[\leadsto y + \left(\color{blue}{x \cdot \left(-y\right)} + \left(--1\right) \cdot x\right) \]
    11. *-commutative100.0%

      \[\leadsto y + \left(\color{blue}{\left(-y\right) \cdot x} + \left(--1\right) \cdot x\right) \]
    12. distribute-rgt-out100.0%

      \[\leadsto y + \color{blue}{x \cdot \left(\left(-y\right) + \left(--1\right)\right)} \]
    13. +-commutative100.0%

      \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) + \left(-y\right)\right)} \]
    14. sub-neg100.0%

      \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) - y\right)} \]
    15. metadata-eval100.0%

      \[\leadsto y + x \cdot \left(\color{blue}{1} - y\right) \]
  3. Simplified100.0%

    \[\leadsto \color{blue}{y + x \cdot \left(1 - y\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in y around 0 72.0%

    \[\leadsto y + \color{blue}{x} \]
  6. Add Preprocessing

Alternative 8: 38.3% accurate, 7.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ x \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 x)
assert(x < y);
double code(double x, double y) {
	return x;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = x
end function
assert x < y;
public static double code(double x, double y) {
	return x;
}
[x, y] = sort([x, y])
def code(x, y):
	return x
x, y = sort([x, y])
function code(x, y)
	return x
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = x;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := x
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
x
\end{array}
Derivation
  1. Initial program 100.0%

    \[\left(x + y\right) - x \cdot y \]
  2. Step-by-step derivation
    1. associate--l+100.0%

      \[\leadsto \color{blue}{x + \left(y - x \cdot y\right)} \]
    2. +-commutative100.0%

      \[\leadsto \color{blue}{\left(y - x \cdot y\right) + x} \]
    3. remove-double-neg100.0%

      \[\leadsto \left(y - x \cdot y\right) + \color{blue}{\left(-\left(-x\right)\right)} \]
    4. unsub-neg100.0%

      \[\leadsto \color{blue}{\left(y - x \cdot y\right) - \left(-x\right)} \]
    5. cancel-sign-sub-inv100.0%

      \[\leadsto \color{blue}{\left(y + \left(-x\right) \cdot y\right)} - \left(-x\right) \]
    6. associate--l+100.0%

      \[\leadsto \color{blue}{y + \left(\left(-x\right) \cdot y - \left(-x\right)\right)} \]
    7. neg-mul-1100.0%

      \[\leadsto y + \left(\left(-x\right) \cdot y - \color{blue}{-1 \cdot x}\right) \]
    8. cancel-sign-sub-inv100.0%

      \[\leadsto y + \color{blue}{\left(\left(-x\right) \cdot y + \left(--1\right) \cdot x\right)} \]
    9. distribute-lft-neg-out100.0%

      \[\leadsto y + \left(\color{blue}{\left(-x \cdot y\right)} + \left(--1\right) \cdot x\right) \]
    10. distribute-rgt-neg-out100.0%

      \[\leadsto y + \left(\color{blue}{x \cdot \left(-y\right)} + \left(--1\right) \cdot x\right) \]
    11. *-commutative100.0%

      \[\leadsto y + \left(\color{blue}{\left(-y\right) \cdot x} + \left(--1\right) \cdot x\right) \]
    12. distribute-rgt-out100.0%

      \[\leadsto y + \color{blue}{x \cdot \left(\left(-y\right) + \left(--1\right)\right)} \]
    13. +-commutative100.0%

      \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) + \left(-y\right)\right)} \]
    14. sub-neg100.0%

      \[\leadsto y + x \cdot \color{blue}{\left(\left(--1\right) - y\right)} \]
    15. metadata-eval100.0%

      \[\leadsto y + x \cdot \left(\color{blue}{1} - y\right) \]
  3. Simplified100.0%

    \[\leadsto \color{blue}{y + x \cdot \left(1 - y\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in y around 0 100.0%

    \[\leadsto \color{blue}{x + y \cdot \left(1 + -1 \cdot x\right)} \]
  6. Step-by-step derivation
    1. +-commutative100.0%

      \[\leadsto \color{blue}{y \cdot \left(1 + -1 \cdot x\right) + x} \]
    2. fma-define100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1 + -1 \cdot x, x\right)} \]
    3. mul-1-neg100.0%

      \[\leadsto \mathsf{fma}\left(y, 1 + \color{blue}{\left(-x\right)}, x\right) \]
    4. unsub-neg100.0%

      \[\leadsto \mathsf{fma}\left(y, \color{blue}{1 - x}, x\right) \]
  7. Simplified100.0%

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1 - x, x\right)} \]
  8. Taylor expanded in y around 0 38.3%

    \[\leadsto \color{blue}{x} \]
  9. Add Preprocessing

Reproduce

?
herbie shell --seed 2024123 
(FPCore (x y)
  :name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, A"
  :precision binary64
  (- (+ x y) (* x y)))