Data.Colour.RGBSpace.HSV:hsv from colour-2.3.3, I

Percentage Accurate: 96.2% → 98.1%
Time: 6.3s
Alternatives: 5
Speedup: 0.5×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 5 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: 96.2% accurate, 1.0× speedup?

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

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

Alternative 1: 98.1% accurate, 0.5× speedup?

\[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ \begin{array}{l} \mathbf{if}\;1 - y \cdot z \leq 5 \cdot 10^{+223}:\\ \;\;\;\;\mathsf{fma}\left(\left(-y\right) \cdot z, x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(-x\right) \cdot z\right) \cdot y\\ \end{array} \end{array} \]
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (<= (- 1.0 (* y z)) 5e+223) (fma (* (- y) z) x x) (* (* (- x) z) y)))
assert(x < y && y < z);
double code(double x, double y, double z) {
	double tmp;
	if ((1.0 - (y * z)) <= 5e+223) {
		tmp = fma((-y * z), x, x);
	} else {
		tmp = (-x * z) * y;
	}
	return tmp;
}
x, y, z = sort([x, y, z])
function code(x, y, z)
	tmp = 0.0
	if (Float64(1.0 - Float64(y * z)) <= 5e+223)
		tmp = fma(Float64(Float64(-y) * z), x, x);
	else
		tmp = Float64(Float64(Float64(-x) * z) * y);
	end
	return tmp
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[LessEqual[N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision], 5e+223], N[(N[((-y) * z), $MachinePrecision] * x + x), $MachinePrecision], N[(N[((-x) * z), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;1 - y \cdot z \leq 5 \cdot 10^{+223}:\\
\;\;\;\;\mathsf{fma}\left(\left(-y\right) \cdot z, x, x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 #s(literal 1 binary64) (*.f64 y z)) < 4.99999999999999985e223

    1. Initial program 98.3%

      \[x \cdot \left(1 - y \cdot z\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{x \cdot \left(1 - y \cdot z\right)} \]
      2. lift--.f64N/A

        \[\leadsto x \cdot \color{blue}{\left(1 - y \cdot z\right)} \]
      3. lift-*.f64N/A

        \[\leadsto x \cdot \left(1 - \color{blue}{y \cdot z}\right) \]
      4. fp-cancel-sub-sign-invN/A

        \[\leadsto x \cdot \color{blue}{\left(1 + \left(\mathsf{neg}\left(y\right)\right) \cdot z\right)} \]
      5. +-commutativeN/A

        \[\leadsto x \cdot \color{blue}{\left(\left(\mathsf{neg}\left(y\right)\right) \cdot z + 1\right)} \]
      6. distribute-rgt-inN/A

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(y\right)\right) \cdot z\right) \cdot x + 1 \cdot x} \]
      7. *-lft-identityN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(y\right)\right) \cdot z\right) \cdot x + \color{blue}{x} \]
      8. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\mathsf{neg}\left(y\right)\right) \cdot z, x, x\right)} \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(y\right)\right) \cdot z}, x, x\right) \]
      10. lower-neg.f6498.3

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(-y\right)} \cdot z, x, x\right) \]
    4. Applied rewrites98.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(-y\right) \cdot z, x, x\right)} \]

    if 4.99999999999999985e223 < (-.f64 #s(literal 1 binary64) (*.f64 y z))

    1. Initial program 79.5%

      \[x \cdot \left(1 - y \cdot z\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{x \cdot \left(1 - y \cdot z\right)} \]
      2. lift--.f64N/A

        \[\leadsto x \cdot \color{blue}{\left(1 - y \cdot z\right)} \]
      3. lift-*.f64N/A

        \[\leadsto x \cdot \left(1 - \color{blue}{y \cdot z}\right) \]
      4. fp-cancel-sub-sign-invN/A

        \[\leadsto x \cdot \color{blue}{\left(1 + \left(\mathsf{neg}\left(y\right)\right) \cdot z\right)} \]
      5. +-commutativeN/A

        \[\leadsto x \cdot \color{blue}{\left(\left(\mathsf{neg}\left(y\right)\right) \cdot z + 1\right)} \]
      6. distribute-rgt-inN/A

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(y\right)\right) \cdot z\right) \cdot x + 1 \cdot x} \]
      7. *-lft-identityN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(y\right)\right) \cdot z\right) \cdot x + \color{blue}{x} \]
      8. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\mathsf{neg}\left(y\right)\right) \cdot z, x, x\right)} \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(y\right)\right) \cdot z}, x, x\right) \]
      10. lower-neg.f6479.5

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(-y\right)} \cdot z, x, x\right) \]
    4. Applied rewrites79.5%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(-y\right) \cdot z, x, x\right)} \]
    5. Applied rewrites43.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt{x}, \sqrt{\left(z \cdot y\right) \cdot \left(\left(x \cdot z\right) \cdot y\right)}, x\right)} \]
    6. Taylor expanded in y around -inf

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(y \cdot z\right)\right)} \]
    7. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(x \cdot \left(y \cdot z\right)\right)} \]
      2. distribute-lft-neg-inN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(x\right)\right) \cdot \left(y \cdot z\right)} \]
      3. *-commutativeN/A

        \[\leadsto \left(\mathsf{neg}\left(x\right)\right) \cdot \color{blue}{\left(z \cdot y\right)} \]
      4. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot z\right) \cdot y} \]
      5. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot z\right) \cdot y} \]
      6. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot z\right)} \cdot y \]
      7. *-rgt-identityN/A

        \[\leadsto \left(\color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot 1\right)} \cdot z\right) \cdot y \]
      8. *-inversesN/A

        \[\leadsto \left(\left(\left(\mathsf{neg}\left(x\right)\right) \cdot \color{blue}{\frac{y}{y}}\right) \cdot z\right) \cdot y \]
      9. associate-/l*N/A

        \[\leadsto \left(\color{blue}{\frac{\left(\mathsf{neg}\left(x\right)\right) \cdot y}{y}} \cdot z\right) \cdot y \]
      10. associate-*l/N/A

        \[\leadsto \left(\color{blue}{\left(\frac{\mathsf{neg}\left(x\right)}{y} \cdot y\right)} \cdot z\right) \cdot y \]
      11. distribute-neg-fracN/A

        \[\leadsto \left(\left(\color{blue}{\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)} \cdot y\right) \cdot z\right) \cdot y \]
      12. mul-1-negN/A

        \[\leadsto \left(\left(\color{blue}{\left(-1 \cdot \frac{x}{y}\right)} \cdot y\right) \cdot z\right) \cdot y \]
      13. remove-double-negN/A

        \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(-1 \cdot \frac{x}{y}\right) \cdot y\right)\right)\right)\right)} \cdot z\right) \cdot y \]
      14. lower-neg.f64N/A

        \[\leadsto \left(\color{blue}{\left(-\left(\mathsf{neg}\left(\left(-1 \cdot \frac{x}{y}\right) \cdot y\right)\right)\right)} \cdot z\right) \cdot y \]
      15. mul-1-negN/A

        \[\leadsto \left(\left(-\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)} \cdot y\right)\right)\right) \cdot z\right) \cdot y \]
      16. distribute-lft-neg-outN/A

        \[\leadsto \left(\left(-\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{x}{y} \cdot y\right)\right)}\right)\right)\right) \cdot z\right) \cdot y \]
      17. remove-double-negN/A

        \[\leadsto \left(\left(-\color{blue}{\frac{x}{y} \cdot y}\right) \cdot z\right) \cdot y \]
      18. associate-*l/N/A

        \[\leadsto \left(\left(-\color{blue}{\frac{x \cdot y}{y}}\right) \cdot z\right) \cdot y \]
      19. associate-/l*N/A

        \[\leadsto \left(\left(-\color{blue}{x \cdot \frac{y}{y}}\right) \cdot z\right) \cdot y \]
      20. *-inversesN/A

        \[\leadsto \left(\left(-x \cdot \color{blue}{1}\right) \cdot z\right) \cdot y \]
      21. *-rgt-identity99.9

        \[\leadsto \left(\left(-\color{blue}{x}\right) \cdot z\right) \cdot y \]
    8. Applied rewrites99.9%

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

Alternative 2: 94.0% accurate, 0.3× speedup?

\[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ \begin{array}{l} t_0 := 1 - y \cdot z\\ \mathbf{if}\;t\_0 \leq -2000000 \lor \neg \left(t\_0 \leq 2\right):\\ \;\;\;\;\left(\left(-x\right) \cdot y\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;x \cdot 1\\ \end{array} \end{array} \]
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (- 1.0 (* y z))))
   (if (or (<= t_0 -2000000.0) (not (<= t_0 2.0)))
     (* (* (- x) y) z)
     (* x 1.0))))
assert(x < y && y < z);
double code(double x, double y, double z) {
	double t_0 = 1.0 - (y * z);
	double tmp;
	if ((t_0 <= -2000000.0) || !(t_0 <= 2.0)) {
		tmp = (-x * y) * z;
	} else {
		tmp = x * 1.0;
	}
	return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 1.0d0 - (y * z)
    if ((t_0 <= (-2000000.0d0)) .or. (.not. (t_0 <= 2.0d0))) then
        tmp = (-x * y) * z
    else
        tmp = x * 1.0d0
    end if
    code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
	double t_0 = 1.0 - (y * z);
	double tmp;
	if ((t_0 <= -2000000.0) || !(t_0 <= 2.0)) {
		tmp = (-x * y) * z;
	} else {
		tmp = x * 1.0;
	}
	return tmp;
}
[x, y, z] = sort([x, y, z])
def code(x, y, z):
	t_0 = 1.0 - (y * z)
	tmp = 0
	if (t_0 <= -2000000.0) or not (t_0 <= 2.0):
		tmp = (-x * y) * z
	else:
		tmp = x * 1.0
	return tmp
x, y, z = sort([x, y, z])
function code(x, y, z)
	t_0 = Float64(1.0 - Float64(y * z))
	tmp = 0.0
	if ((t_0 <= -2000000.0) || !(t_0 <= 2.0))
		tmp = Float64(Float64(Float64(-x) * y) * z);
	else
		tmp = Float64(x * 1.0);
	end
	return tmp
end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
	t_0 = 1.0 - (y * z);
	tmp = 0.0;
	if ((t_0 <= -2000000.0) || ~((t_0 <= 2.0)))
		tmp = (-x * y) * z;
	else
		tmp = x * 1.0;
	end
	tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -2000000.0], N[Not[LessEqual[t$95$0, 2.0]], $MachinePrecision]], N[(N[((-x) * y), $MachinePrecision] * z), $MachinePrecision], N[(x * 1.0), $MachinePrecision]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
t_0 := 1 - y \cdot z\\
\mathbf{if}\;t\_0 \leq -2000000 \lor \neg \left(t\_0 \leq 2\right):\\
\;\;\;\;\left(\left(-x\right) \cdot y\right) \cdot z\\

\mathbf{else}:\\
\;\;\;\;x \cdot 1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 #s(literal 1 binary64) (*.f64 y z)) < -2e6 or 2 < (-.f64 #s(literal 1 binary64) (*.f64 y z))

    1. Initial program 92.6%

      \[x \cdot \left(1 - y \cdot z\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{x \cdot \left(1 - y \cdot z\right)} \]
      2. lift--.f64N/A

        \[\leadsto x \cdot \color{blue}{\left(1 - y \cdot z\right)} \]
      3. lift-*.f64N/A

        \[\leadsto x \cdot \left(1 - \color{blue}{y \cdot z}\right) \]
      4. fp-cancel-sub-sign-invN/A

        \[\leadsto x \cdot \color{blue}{\left(1 + \left(\mathsf{neg}\left(y\right)\right) \cdot z\right)} \]
      5. +-commutativeN/A

        \[\leadsto x \cdot \color{blue}{\left(\left(\mathsf{neg}\left(y\right)\right) \cdot z + 1\right)} \]
      6. distribute-rgt-inN/A

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(y\right)\right) \cdot z\right) \cdot x + 1 \cdot x} \]
      7. *-lft-identityN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(y\right)\right) \cdot z\right) \cdot x + \color{blue}{x} \]
      8. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\mathsf{neg}\left(y\right)\right) \cdot z, x, x\right)} \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(y\right)\right) \cdot z}, x, x\right) \]
      10. lower-neg.f6492.6

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(-y\right)} \cdot z, x, x\right) \]
    4. Applied rewrites92.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(-y\right) \cdot z, x, x\right)} \]
    5. Applied rewrites22.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt{x}, \sqrt{\left(z \cdot y\right) \cdot \left(\left(x \cdot z\right) \cdot y\right)}, x\right)} \]
    6. Taylor expanded in y around -inf

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(y \cdot z\right)\right)} \]
    7. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(x \cdot \left(y \cdot z\right)\right)} \]
      2. distribute-lft-neg-inN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(x\right)\right) \cdot \left(y \cdot z\right)} \]
      3. *-commutativeN/A

        \[\leadsto \left(\mathsf{neg}\left(x\right)\right) \cdot \color{blue}{\left(z \cdot y\right)} \]
      4. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot z\right) \cdot y} \]
      5. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot z\right) \cdot y} \]
      6. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot z\right)} \cdot y \]
      7. *-rgt-identityN/A

        \[\leadsto \left(\color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot 1\right)} \cdot z\right) \cdot y \]
      8. *-inversesN/A

        \[\leadsto \left(\left(\left(\mathsf{neg}\left(x\right)\right) \cdot \color{blue}{\frac{y}{y}}\right) \cdot z\right) \cdot y \]
      9. associate-/l*N/A

        \[\leadsto \left(\color{blue}{\frac{\left(\mathsf{neg}\left(x\right)\right) \cdot y}{y}} \cdot z\right) \cdot y \]
      10. associate-*l/N/A

        \[\leadsto \left(\color{blue}{\left(\frac{\mathsf{neg}\left(x\right)}{y} \cdot y\right)} \cdot z\right) \cdot y \]
      11. distribute-neg-fracN/A

        \[\leadsto \left(\left(\color{blue}{\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)} \cdot y\right) \cdot z\right) \cdot y \]
      12. mul-1-negN/A

        \[\leadsto \left(\left(\color{blue}{\left(-1 \cdot \frac{x}{y}\right)} \cdot y\right) \cdot z\right) \cdot y \]
      13. remove-double-negN/A

        \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(-1 \cdot \frac{x}{y}\right) \cdot y\right)\right)\right)\right)} \cdot z\right) \cdot y \]
      14. lower-neg.f64N/A

        \[\leadsto \left(\color{blue}{\left(-\left(\mathsf{neg}\left(\left(-1 \cdot \frac{x}{y}\right) \cdot y\right)\right)\right)} \cdot z\right) \cdot y \]
      15. mul-1-negN/A

        \[\leadsto \left(\left(-\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)} \cdot y\right)\right)\right) \cdot z\right) \cdot y \]
      16. distribute-lft-neg-outN/A

        \[\leadsto \left(\left(-\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{x}{y} \cdot y\right)\right)}\right)\right)\right) \cdot z\right) \cdot y \]
      17. remove-double-negN/A

        \[\leadsto \left(\left(-\color{blue}{\frac{x}{y} \cdot y}\right) \cdot z\right) \cdot y \]
      18. associate-*l/N/A

        \[\leadsto \left(\left(-\color{blue}{\frac{x \cdot y}{y}}\right) \cdot z\right) \cdot y \]
      19. associate-/l*N/A

        \[\leadsto \left(\left(-\color{blue}{x \cdot \frac{y}{y}}\right) \cdot z\right) \cdot y \]
      20. *-inversesN/A

        \[\leadsto \left(\left(-x \cdot \color{blue}{1}\right) \cdot z\right) \cdot y \]
      21. *-rgt-identity90.1

        \[\leadsto \left(\left(-\color{blue}{x}\right) \cdot z\right) \cdot y \]
    8. Applied rewrites90.1%

      \[\leadsto \color{blue}{\left(\left(-x\right) \cdot z\right) \cdot y} \]
    9. Step-by-step derivation
      1. Applied rewrites90.0%

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

      if -2e6 < (-.f64 #s(literal 1 binary64) (*.f64 y z)) < 2

      1. Initial program 100.0%

        \[x \cdot \left(1 - y \cdot z\right) \]
      2. Add Preprocessing
      3. Taylor expanded in y around 0

        \[\leadsto x \cdot \color{blue}{1} \]
      4. Step-by-step derivation
        1. Applied rewrites98.8%

          \[\leadsto x \cdot \color{blue}{1} \]
      5. Recombined 2 regimes into one program.
      6. Final simplification94.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;1 - y \cdot z \leq -2000000 \lor \neg \left(1 - y \cdot z \leq 2\right):\\ \;\;\;\;\left(\left(-x\right) \cdot y\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;x \cdot 1\\ \end{array} \]
      7. Add Preprocessing

      Alternative 3: 94.0% accurate, 0.3× speedup?

      \[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ \begin{array}{l} t_0 := 1 - y \cdot z\\ \mathbf{if}\;t\_0 \leq -2000000:\\ \;\;\;\;\left(\left(-x\right) \cdot z\right) \cdot y\\ \mathbf{elif}\;t\_0 \leq 2:\\ \;\;\;\;x \cdot 1\\ \mathbf{else}:\\ \;\;\;\;\left(\left(-x\right) \cdot y\right) \cdot z\\ \end{array} \end{array} \]
      NOTE: x, y, and z should be sorted in increasing order before calling this function.
      (FPCore (x y z)
       :precision binary64
       (let* ((t_0 (- 1.0 (* y z))))
         (if (<= t_0 -2000000.0)
           (* (* (- x) z) y)
           (if (<= t_0 2.0) (* x 1.0) (* (* (- x) y) z)))))
      assert(x < y && y < z);
      double code(double x, double y, double z) {
      	double t_0 = 1.0 - (y * z);
      	double tmp;
      	if (t_0 <= -2000000.0) {
      		tmp = (-x * z) * y;
      	} else if (t_0 <= 2.0) {
      		tmp = x * 1.0;
      	} else {
      		tmp = (-x * y) * z;
      	}
      	return tmp;
      }
      
      NOTE: x, y, and z should be sorted in increasing order before calling this function.
      real(8) function code(x, y, z)
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          real(8), intent (in) :: z
          real(8) :: t_0
          real(8) :: tmp
          t_0 = 1.0d0 - (y * z)
          if (t_0 <= (-2000000.0d0)) then
              tmp = (-x * z) * y
          else if (t_0 <= 2.0d0) then
              tmp = x * 1.0d0
          else
              tmp = (-x * y) * z
          end if
          code = tmp
      end function
      
      assert x < y && y < z;
      public static double code(double x, double y, double z) {
      	double t_0 = 1.0 - (y * z);
      	double tmp;
      	if (t_0 <= -2000000.0) {
      		tmp = (-x * z) * y;
      	} else if (t_0 <= 2.0) {
      		tmp = x * 1.0;
      	} else {
      		tmp = (-x * y) * z;
      	}
      	return tmp;
      }
      
      [x, y, z] = sort([x, y, z])
      def code(x, y, z):
      	t_0 = 1.0 - (y * z)
      	tmp = 0
      	if t_0 <= -2000000.0:
      		tmp = (-x * z) * y
      	elif t_0 <= 2.0:
      		tmp = x * 1.0
      	else:
      		tmp = (-x * y) * z
      	return tmp
      
      x, y, z = sort([x, y, z])
      function code(x, y, z)
      	t_0 = Float64(1.0 - Float64(y * z))
      	tmp = 0.0
      	if (t_0 <= -2000000.0)
      		tmp = Float64(Float64(Float64(-x) * z) * y);
      	elseif (t_0 <= 2.0)
      		tmp = Float64(x * 1.0);
      	else
      		tmp = Float64(Float64(Float64(-x) * y) * z);
      	end
      	return tmp
      end
      
      x, y, z = num2cell(sort([x, y, z])){:}
      function tmp_2 = code(x, y, z)
      	t_0 = 1.0 - (y * z);
      	tmp = 0.0;
      	if (t_0 <= -2000000.0)
      		tmp = (-x * z) * y;
      	elseif (t_0 <= 2.0)
      		tmp = x * 1.0;
      	else
      		tmp = (-x * y) * z;
      	end
      	tmp_2 = tmp;
      end
      
      NOTE: x, y, and z should be sorted in increasing order before calling this function.
      code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2000000.0], N[(N[((-x) * z), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$0, 2.0], N[(x * 1.0), $MachinePrecision], N[(N[((-x) * y), $MachinePrecision] * z), $MachinePrecision]]]]
      
      \begin{array}{l}
      [x, y, z] = \mathsf{sort}([x, y, z])\\
      \\
      \begin{array}{l}
      t_0 := 1 - y \cdot z\\
      \mathbf{if}\;t\_0 \leq -2000000:\\
      \;\;\;\;\left(\left(-x\right) \cdot z\right) \cdot y\\
      
      \mathbf{elif}\;t\_0 \leq 2:\\
      \;\;\;\;x \cdot 1\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(\left(-x\right) \cdot y\right) \cdot z\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if (-.f64 #s(literal 1 binary64) (*.f64 y z)) < -2e6

        1. Initial program 93.0%

          \[x \cdot \left(1 - y \cdot z\right) \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \color{blue}{x \cdot \left(1 - y \cdot z\right)} \]
          2. lift--.f64N/A

            \[\leadsto x \cdot \color{blue}{\left(1 - y \cdot z\right)} \]
          3. lift-*.f64N/A

            \[\leadsto x \cdot \left(1 - \color{blue}{y \cdot z}\right) \]
          4. fp-cancel-sub-sign-invN/A

            \[\leadsto x \cdot \color{blue}{\left(1 + \left(\mathsf{neg}\left(y\right)\right) \cdot z\right)} \]
          5. +-commutativeN/A

            \[\leadsto x \cdot \color{blue}{\left(\left(\mathsf{neg}\left(y\right)\right) \cdot z + 1\right)} \]
          6. distribute-rgt-inN/A

            \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(y\right)\right) \cdot z\right) \cdot x + 1 \cdot x} \]
          7. *-lft-identityN/A

            \[\leadsto \left(\left(\mathsf{neg}\left(y\right)\right) \cdot z\right) \cdot x + \color{blue}{x} \]
          8. lower-fma.f64N/A

            \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\mathsf{neg}\left(y\right)\right) \cdot z, x, x\right)} \]
          9. lower-*.f64N/A

            \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(y\right)\right) \cdot z}, x, x\right) \]
          10. lower-neg.f6493.0

            \[\leadsto \mathsf{fma}\left(\color{blue}{\left(-y\right)} \cdot z, x, x\right) \]
        4. Applied rewrites93.0%

          \[\leadsto \color{blue}{\mathsf{fma}\left(\left(-y\right) \cdot z, x, x\right)} \]
        5. Applied rewrites0.5%

          \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt{x}, \sqrt{\left(z \cdot y\right) \cdot \left(\left(x \cdot z\right) \cdot y\right)}, x\right)} \]
        6. Taylor expanded in y around -inf

          \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(y \cdot z\right)\right)} \]
        7. Step-by-step derivation
          1. mul-1-negN/A

            \[\leadsto \color{blue}{\mathsf{neg}\left(x \cdot \left(y \cdot z\right)\right)} \]
          2. distribute-lft-neg-inN/A

            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(x\right)\right) \cdot \left(y \cdot z\right)} \]
          3. *-commutativeN/A

            \[\leadsto \left(\mathsf{neg}\left(x\right)\right) \cdot \color{blue}{\left(z \cdot y\right)} \]
          4. associate-*r*N/A

            \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot z\right) \cdot y} \]
          5. lower-*.f64N/A

            \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot z\right) \cdot y} \]
          6. lower-*.f64N/A

            \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot z\right)} \cdot y \]
          7. *-rgt-identityN/A

            \[\leadsto \left(\color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot 1\right)} \cdot z\right) \cdot y \]
          8. *-inversesN/A

            \[\leadsto \left(\left(\left(\mathsf{neg}\left(x\right)\right) \cdot \color{blue}{\frac{y}{y}}\right) \cdot z\right) \cdot y \]
          9. associate-/l*N/A

            \[\leadsto \left(\color{blue}{\frac{\left(\mathsf{neg}\left(x\right)\right) \cdot y}{y}} \cdot z\right) \cdot y \]
          10. associate-*l/N/A

            \[\leadsto \left(\color{blue}{\left(\frac{\mathsf{neg}\left(x\right)}{y} \cdot y\right)} \cdot z\right) \cdot y \]
          11. distribute-neg-fracN/A

            \[\leadsto \left(\left(\color{blue}{\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)} \cdot y\right) \cdot z\right) \cdot y \]
          12. mul-1-negN/A

            \[\leadsto \left(\left(\color{blue}{\left(-1 \cdot \frac{x}{y}\right)} \cdot y\right) \cdot z\right) \cdot y \]
          13. remove-double-negN/A

            \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(-1 \cdot \frac{x}{y}\right) \cdot y\right)\right)\right)\right)} \cdot z\right) \cdot y \]
          14. lower-neg.f64N/A

            \[\leadsto \left(\color{blue}{\left(-\left(\mathsf{neg}\left(\left(-1 \cdot \frac{x}{y}\right) \cdot y\right)\right)\right)} \cdot z\right) \cdot y \]
          15. mul-1-negN/A

            \[\leadsto \left(\left(-\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)} \cdot y\right)\right)\right) \cdot z\right) \cdot y \]
          16. distribute-lft-neg-outN/A

            \[\leadsto \left(\left(-\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{x}{y} \cdot y\right)\right)}\right)\right)\right) \cdot z\right) \cdot y \]
          17. remove-double-negN/A

            \[\leadsto \left(\left(-\color{blue}{\frac{x}{y} \cdot y}\right) \cdot z\right) \cdot y \]
          18. associate-*l/N/A

            \[\leadsto \left(\left(-\color{blue}{\frac{x \cdot y}{y}}\right) \cdot z\right) \cdot y \]
          19. associate-/l*N/A

            \[\leadsto \left(\left(-\color{blue}{x \cdot \frac{y}{y}}\right) \cdot z\right) \cdot y \]
          20. *-inversesN/A

            \[\leadsto \left(\left(-x \cdot \color{blue}{1}\right) \cdot z\right) \cdot y \]
          21. *-rgt-identity90.9

            \[\leadsto \left(\left(-\color{blue}{x}\right) \cdot z\right) \cdot y \]
        8. Applied rewrites90.9%

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

        if -2e6 < (-.f64 #s(literal 1 binary64) (*.f64 y z)) < 2

        1. Initial program 100.0%

          \[x \cdot \left(1 - y \cdot z\right) \]
        2. Add Preprocessing
        3. Taylor expanded in y around 0

          \[\leadsto x \cdot \color{blue}{1} \]
        4. Step-by-step derivation
          1. Applied rewrites98.8%

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

          if 2 < (-.f64 #s(literal 1 binary64) (*.f64 y z))

          1. Initial program 92.3%

            \[x \cdot \left(1 - y \cdot z\right) \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. lift-*.f64N/A

              \[\leadsto \color{blue}{x \cdot \left(1 - y \cdot z\right)} \]
            2. lift--.f64N/A

              \[\leadsto x \cdot \color{blue}{\left(1 - y \cdot z\right)} \]
            3. lift-*.f64N/A

              \[\leadsto x \cdot \left(1 - \color{blue}{y \cdot z}\right) \]
            4. fp-cancel-sub-sign-invN/A

              \[\leadsto x \cdot \color{blue}{\left(1 + \left(\mathsf{neg}\left(y\right)\right) \cdot z\right)} \]
            5. +-commutativeN/A

              \[\leadsto x \cdot \color{blue}{\left(\left(\mathsf{neg}\left(y\right)\right) \cdot z + 1\right)} \]
            6. distribute-rgt-inN/A

              \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(y\right)\right) \cdot z\right) \cdot x + 1 \cdot x} \]
            7. *-lft-identityN/A

              \[\leadsto \left(\left(\mathsf{neg}\left(y\right)\right) \cdot z\right) \cdot x + \color{blue}{x} \]
            8. lower-fma.f64N/A

              \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\mathsf{neg}\left(y\right)\right) \cdot z, x, x\right)} \]
            9. lower-*.f64N/A

              \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(y\right)\right) \cdot z}, x, x\right) \]
            10. lower-neg.f6492.3

              \[\leadsto \mathsf{fma}\left(\color{blue}{\left(-y\right)} \cdot z, x, x\right) \]
          4. Applied rewrites92.3%

            \[\leadsto \color{blue}{\mathsf{fma}\left(\left(-y\right) \cdot z, x, x\right)} \]
          5. Applied rewrites41.7%

            \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt{x}, \sqrt{\left(z \cdot y\right) \cdot \left(\left(x \cdot z\right) \cdot y\right)}, x\right)} \]
          6. Taylor expanded in y around -inf

            \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(y \cdot z\right)\right)} \]
          7. Step-by-step derivation
            1. mul-1-negN/A

              \[\leadsto \color{blue}{\mathsf{neg}\left(x \cdot \left(y \cdot z\right)\right)} \]
            2. distribute-lft-neg-inN/A

              \[\leadsto \color{blue}{\left(\mathsf{neg}\left(x\right)\right) \cdot \left(y \cdot z\right)} \]
            3. *-commutativeN/A

              \[\leadsto \left(\mathsf{neg}\left(x\right)\right) \cdot \color{blue}{\left(z \cdot y\right)} \]
            4. associate-*r*N/A

              \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot z\right) \cdot y} \]
            5. lower-*.f64N/A

              \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot z\right) \cdot y} \]
            6. lower-*.f64N/A

              \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot z\right)} \cdot y \]
            7. *-rgt-identityN/A

              \[\leadsto \left(\color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot 1\right)} \cdot z\right) \cdot y \]
            8. *-inversesN/A

              \[\leadsto \left(\left(\left(\mathsf{neg}\left(x\right)\right) \cdot \color{blue}{\frac{y}{y}}\right) \cdot z\right) \cdot y \]
            9. associate-/l*N/A

              \[\leadsto \left(\color{blue}{\frac{\left(\mathsf{neg}\left(x\right)\right) \cdot y}{y}} \cdot z\right) \cdot y \]
            10. associate-*l/N/A

              \[\leadsto \left(\color{blue}{\left(\frac{\mathsf{neg}\left(x\right)}{y} \cdot y\right)} \cdot z\right) \cdot y \]
            11. distribute-neg-fracN/A

              \[\leadsto \left(\left(\color{blue}{\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)} \cdot y\right) \cdot z\right) \cdot y \]
            12. mul-1-negN/A

              \[\leadsto \left(\left(\color{blue}{\left(-1 \cdot \frac{x}{y}\right)} \cdot y\right) \cdot z\right) \cdot y \]
            13. remove-double-negN/A

              \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(-1 \cdot \frac{x}{y}\right) \cdot y\right)\right)\right)\right)} \cdot z\right) \cdot y \]
            14. lower-neg.f64N/A

              \[\leadsto \left(\color{blue}{\left(-\left(\mathsf{neg}\left(\left(-1 \cdot \frac{x}{y}\right) \cdot y\right)\right)\right)} \cdot z\right) \cdot y \]
            15. mul-1-negN/A

              \[\leadsto \left(\left(-\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)} \cdot y\right)\right)\right) \cdot z\right) \cdot y \]
            16. distribute-lft-neg-outN/A

              \[\leadsto \left(\left(-\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{x}{y} \cdot y\right)\right)}\right)\right)\right) \cdot z\right) \cdot y \]
            17. remove-double-negN/A

              \[\leadsto \left(\left(-\color{blue}{\frac{x}{y} \cdot y}\right) \cdot z\right) \cdot y \]
            18. associate-*l/N/A

              \[\leadsto \left(\left(-\color{blue}{\frac{x \cdot y}{y}}\right) \cdot z\right) \cdot y \]
            19. associate-/l*N/A

              \[\leadsto \left(\left(-\color{blue}{x \cdot \frac{y}{y}}\right) \cdot z\right) \cdot y \]
            20. *-inversesN/A

              \[\leadsto \left(\left(-x \cdot \color{blue}{1}\right) \cdot z\right) \cdot y \]
            21. *-rgt-identity89.3

              \[\leadsto \left(\left(-\color{blue}{x}\right) \cdot z\right) \cdot y \]
          8. Applied rewrites89.3%

            \[\leadsto \color{blue}{\left(\left(-x\right) \cdot z\right) \cdot y} \]
          9. Step-by-step derivation
            1. Applied rewrites91.2%

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

          Alternative 4: 98.0% accurate, 0.5× speedup?

          \[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ \begin{array}{l} t_0 := 1 - y \cdot z\\ \mathbf{if}\;t\_0 \leq 5 \cdot 10^{+223}:\\ \;\;\;\;x \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;\left(\left(-x\right) \cdot z\right) \cdot y\\ \end{array} \end{array} \]
          NOTE: x, y, and z should be sorted in increasing order before calling this function.
          (FPCore (x y z)
           :precision binary64
           (let* ((t_0 (- 1.0 (* y z))))
             (if (<= t_0 5e+223) (* x t_0) (* (* (- x) z) y))))
          assert(x < y && y < z);
          double code(double x, double y, double z) {
          	double t_0 = 1.0 - (y * z);
          	double tmp;
          	if (t_0 <= 5e+223) {
          		tmp = x * t_0;
          	} else {
          		tmp = (-x * z) * y;
          	}
          	return tmp;
          }
          
          NOTE: x, y, and z should be sorted in increasing order before calling this function.
          real(8) function code(x, y, z)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              real(8), intent (in) :: z
              real(8) :: t_0
              real(8) :: tmp
              t_0 = 1.0d0 - (y * z)
              if (t_0 <= 5d+223) then
                  tmp = x * t_0
              else
                  tmp = (-x * z) * y
              end if
              code = tmp
          end function
          
          assert x < y && y < z;
          public static double code(double x, double y, double z) {
          	double t_0 = 1.0 - (y * z);
          	double tmp;
          	if (t_0 <= 5e+223) {
          		tmp = x * t_0;
          	} else {
          		tmp = (-x * z) * y;
          	}
          	return tmp;
          }
          
          [x, y, z] = sort([x, y, z])
          def code(x, y, z):
          	t_0 = 1.0 - (y * z)
          	tmp = 0
          	if t_0 <= 5e+223:
          		tmp = x * t_0
          	else:
          		tmp = (-x * z) * y
          	return tmp
          
          x, y, z = sort([x, y, z])
          function code(x, y, z)
          	t_0 = Float64(1.0 - Float64(y * z))
          	tmp = 0.0
          	if (t_0 <= 5e+223)
          		tmp = Float64(x * t_0);
          	else
          		tmp = Float64(Float64(Float64(-x) * z) * y);
          	end
          	return tmp
          end
          
          x, y, z = num2cell(sort([x, y, z])){:}
          function tmp_2 = code(x, y, z)
          	t_0 = 1.0 - (y * z);
          	tmp = 0.0;
          	if (t_0 <= 5e+223)
          		tmp = x * t_0;
          	else
          		tmp = (-x * z) * y;
          	end
          	tmp_2 = tmp;
          end
          
          NOTE: x, y, and z should be sorted in increasing order before calling this function.
          code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 5e+223], N[(x * t$95$0), $MachinePrecision], N[(N[((-x) * z), $MachinePrecision] * y), $MachinePrecision]]]
          
          \begin{array}{l}
          [x, y, z] = \mathsf{sort}([x, y, z])\\
          \\
          \begin{array}{l}
          t_0 := 1 - y \cdot z\\
          \mathbf{if}\;t\_0 \leq 5 \cdot 10^{+223}:\\
          \;\;\;\;x \cdot t\_0\\
          
          \mathbf{else}:\\
          \;\;\;\;\left(\left(-x\right) \cdot z\right) \cdot y\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (-.f64 #s(literal 1 binary64) (*.f64 y z)) < 4.99999999999999985e223

            1. Initial program 98.3%

              \[x \cdot \left(1 - y \cdot z\right) \]
            2. Add Preprocessing

            if 4.99999999999999985e223 < (-.f64 #s(literal 1 binary64) (*.f64 y z))

            1. Initial program 79.5%

              \[x \cdot \left(1 - y \cdot z\right) \]
            2. Add Preprocessing
            3. Step-by-step derivation
              1. lift-*.f64N/A

                \[\leadsto \color{blue}{x \cdot \left(1 - y \cdot z\right)} \]
              2. lift--.f64N/A

                \[\leadsto x \cdot \color{blue}{\left(1 - y \cdot z\right)} \]
              3. lift-*.f64N/A

                \[\leadsto x \cdot \left(1 - \color{blue}{y \cdot z}\right) \]
              4. fp-cancel-sub-sign-invN/A

                \[\leadsto x \cdot \color{blue}{\left(1 + \left(\mathsf{neg}\left(y\right)\right) \cdot z\right)} \]
              5. +-commutativeN/A

                \[\leadsto x \cdot \color{blue}{\left(\left(\mathsf{neg}\left(y\right)\right) \cdot z + 1\right)} \]
              6. distribute-rgt-inN/A

                \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(y\right)\right) \cdot z\right) \cdot x + 1 \cdot x} \]
              7. *-lft-identityN/A

                \[\leadsto \left(\left(\mathsf{neg}\left(y\right)\right) \cdot z\right) \cdot x + \color{blue}{x} \]
              8. lower-fma.f64N/A

                \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\mathsf{neg}\left(y\right)\right) \cdot z, x, x\right)} \]
              9. lower-*.f64N/A

                \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(y\right)\right) \cdot z}, x, x\right) \]
              10. lower-neg.f6479.5

                \[\leadsto \mathsf{fma}\left(\color{blue}{\left(-y\right)} \cdot z, x, x\right) \]
            4. Applied rewrites79.5%

              \[\leadsto \color{blue}{\mathsf{fma}\left(\left(-y\right) \cdot z, x, x\right)} \]
            5. Applied rewrites43.9%

              \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt{x}, \sqrt{\left(z \cdot y\right) \cdot \left(\left(x \cdot z\right) \cdot y\right)}, x\right)} \]
            6. Taylor expanded in y around -inf

              \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(y \cdot z\right)\right)} \]
            7. Step-by-step derivation
              1. mul-1-negN/A

                \[\leadsto \color{blue}{\mathsf{neg}\left(x \cdot \left(y \cdot z\right)\right)} \]
              2. distribute-lft-neg-inN/A

                \[\leadsto \color{blue}{\left(\mathsf{neg}\left(x\right)\right) \cdot \left(y \cdot z\right)} \]
              3. *-commutativeN/A

                \[\leadsto \left(\mathsf{neg}\left(x\right)\right) \cdot \color{blue}{\left(z \cdot y\right)} \]
              4. associate-*r*N/A

                \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot z\right) \cdot y} \]
              5. lower-*.f64N/A

                \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot z\right) \cdot y} \]
              6. lower-*.f64N/A

                \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot z\right)} \cdot y \]
              7. *-rgt-identityN/A

                \[\leadsto \left(\color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot 1\right)} \cdot z\right) \cdot y \]
              8. *-inversesN/A

                \[\leadsto \left(\left(\left(\mathsf{neg}\left(x\right)\right) \cdot \color{blue}{\frac{y}{y}}\right) \cdot z\right) \cdot y \]
              9. associate-/l*N/A

                \[\leadsto \left(\color{blue}{\frac{\left(\mathsf{neg}\left(x\right)\right) \cdot y}{y}} \cdot z\right) \cdot y \]
              10. associate-*l/N/A

                \[\leadsto \left(\color{blue}{\left(\frac{\mathsf{neg}\left(x\right)}{y} \cdot y\right)} \cdot z\right) \cdot y \]
              11. distribute-neg-fracN/A

                \[\leadsto \left(\left(\color{blue}{\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)} \cdot y\right) \cdot z\right) \cdot y \]
              12. mul-1-negN/A

                \[\leadsto \left(\left(\color{blue}{\left(-1 \cdot \frac{x}{y}\right)} \cdot y\right) \cdot z\right) \cdot y \]
              13. remove-double-negN/A

                \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(-1 \cdot \frac{x}{y}\right) \cdot y\right)\right)\right)\right)} \cdot z\right) \cdot y \]
              14. lower-neg.f64N/A

                \[\leadsto \left(\color{blue}{\left(-\left(\mathsf{neg}\left(\left(-1 \cdot \frac{x}{y}\right) \cdot y\right)\right)\right)} \cdot z\right) \cdot y \]
              15. mul-1-negN/A

                \[\leadsto \left(\left(-\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)} \cdot y\right)\right)\right) \cdot z\right) \cdot y \]
              16. distribute-lft-neg-outN/A

                \[\leadsto \left(\left(-\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{x}{y} \cdot y\right)\right)}\right)\right)\right) \cdot z\right) \cdot y \]
              17. remove-double-negN/A

                \[\leadsto \left(\left(-\color{blue}{\frac{x}{y} \cdot y}\right) \cdot z\right) \cdot y \]
              18. associate-*l/N/A

                \[\leadsto \left(\left(-\color{blue}{\frac{x \cdot y}{y}}\right) \cdot z\right) \cdot y \]
              19. associate-/l*N/A

                \[\leadsto \left(\left(-\color{blue}{x \cdot \frac{y}{y}}\right) \cdot z\right) \cdot y \]
              20. *-inversesN/A

                \[\leadsto \left(\left(-x \cdot \color{blue}{1}\right) \cdot z\right) \cdot y \]
              21. *-rgt-identity99.9

                \[\leadsto \left(\left(-\color{blue}{x}\right) \cdot z\right) \cdot y \]
            8. Applied rewrites99.9%

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

          Alternative 5: 50.2% accurate, 2.3× speedup?

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

            \[x \cdot \left(1 - y \cdot z\right) \]
          2. Add Preprocessing
          3. Taylor expanded in y around 0

            \[\leadsto x \cdot \color{blue}{1} \]
          4. Step-by-step derivation
            1. Applied rewrites55.0%

              \[\leadsto x \cdot \color{blue}{1} \]
            2. Add Preprocessing

            Reproduce

            ?
            herbie shell --seed 2024340 
            (FPCore (x y z)
              :name "Data.Colour.RGBSpace.HSV:hsv from colour-2.3.3, I"
              :precision binary64
              (* x (- 1.0 (* y z))))