Average Error: 3.2 → 0.1
Time: 4.4s
Precision: binary64
\[[y, z] = \mathsf{sort}([y, z]) \\]
\[x \cdot \left(1 - y \cdot z\right) \]
\[\begin{array}{l} \mathbf{if}\;y \cdot z \leq -\infty \lor \neg \left(y \cdot z \leq 3.0891584870050743 \cdot 10^{+301}\right):\\ \;\;\;\;-y \cdot \left(z \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x - \left(y \cdot z\right) \cdot x\right) + x \cdot \mathsf{fma}\left(-z, y, y \cdot z\right)\\ \end{array} \]
x \cdot \left(1 - y \cdot z\right)
\begin{array}{l}
\mathbf{if}\;y \cdot z \leq -\infty \lor \neg \left(y \cdot z \leq 3.0891584870050743 \cdot 10^{+301}\right):\\
\;\;\;\;-y \cdot \left(z \cdot x\right)\\

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


\end{array}
(FPCore (x y z) :precision binary64 (* x (- 1.0 (* y z))))
(FPCore (x y z)
 :precision binary64
 (if (or (<= (* y z) (- INFINITY)) (not (<= (* y z) 3.0891584870050743e+301)))
   (- (* y (* z x)))
   (+ (- x (* (* y z) x)) (* x (fma (- z) y (* y z))))))
double code(double x, double y, double z) {
	return x * (1.0 - (y * z));
}
double code(double x, double y, double z) {
	double tmp;
	if (((y * z) <= -((double) INFINITY)) || !((y * z) <= 3.0891584870050743e+301)) {
		tmp = -(y * (z * x));
	} else {
		tmp = (x - ((y * z) * x)) + (x * fma(-z, y, (y * z)));
	}
	return tmp;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Split input into 2 regimes
  2. if (*.f64 y z) < -inf.0 or 3.0891584870050743e301 < (*.f64 y z)

    1. Initial program 62.4

      \[x \cdot \left(1 - y \cdot z\right) \]
    2. Taylor expanded in y around inf 0.2

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot \left(z \cdot x\right)\right)} \]
    3. Simplified0.2

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

    if -inf.0 < (*.f64 y z) < 3.0891584870050743e301

    1. Initial program 0.1

      \[x \cdot \left(1 - y \cdot z\right) \]
    2. Applied *-un-lft-identity_binary640.1

      \[\leadsto x \cdot \left(\color{blue}{1 \cdot 1} - y \cdot z\right) \]
    3. Applied prod-diff_binary640.1

      \[\leadsto x \cdot \color{blue}{\left(\mathsf{fma}\left(1, 1, -z \cdot y\right) + \mathsf{fma}\left(-z, y, z \cdot y\right)\right)} \]
    4. Applied distribute-rgt-in_binary640.1

      \[\leadsto \color{blue}{\mathsf{fma}\left(1, 1, -z \cdot y\right) \cdot x + \mathsf{fma}\left(-z, y, z \cdot y\right) \cdot x} \]
    5. Applied add-cube-cbrt_binary641.4

      \[\leadsto \mathsf{fma}\left(1, 1, -z \cdot y\right) \cdot \color{blue}{\left(\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}\right)} + \mathsf{fma}\left(-z, y, z \cdot y\right) \cdot x \]
    6. Applied associate-*r*_binary641.4

      \[\leadsto \color{blue}{\left(\mathsf{fma}\left(1, 1, -z \cdot y\right) \cdot \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right)\right) \cdot \sqrt[3]{x}} + \mathsf{fma}\left(-z, y, z \cdot y\right) \cdot x \]
    7. Simplified1.4

      \[\leadsto \color{blue}{\left(\left(1 - y \cdot z\right) \cdot \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right)\right)} \cdot \sqrt[3]{x} + \mathsf{fma}\left(-z, y, z \cdot y\right) \cdot x \]
    8. Taylor expanded in y around 0 4.9

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

      \[\leadsto \color{blue}{\left(x - x \cdot \left(y \cdot z\right)\right)} + \mathsf{fma}\left(-z, y, z \cdot y\right) \cdot x \]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot z \leq -\infty \lor \neg \left(y \cdot z \leq 3.0891584870050743 \cdot 10^{+301}\right):\\ \;\;\;\;-y \cdot \left(z \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x - \left(y \cdot z\right) \cdot x\right) + x \cdot \mathsf{fma}\left(-z, y, y \cdot z\right)\\ \end{array} \]

Reproduce

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