Average Error: 3.3 → 1.7
Time: 2.5s
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 3.986975430109517 \cdot 10^{+271}:\\ \;\;\;\;\left(1 - y \cdot z\right) \cdot x + x \cdot \mathsf{fma}\left(-z, y, y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;-y \cdot \left(z \cdot x\right)\\ \end{array} \]
x \cdot \left(1 - y \cdot z\right)
\begin{array}{l}
\mathbf{if}\;y \cdot z \leq 3.986975430109517 \cdot 10^{+271}:\\
\;\;\;\;\left(1 - y \cdot z\right) \cdot x + x \cdot \mathsf{fma}\left(-z, y, y \cdot z\right)\\

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


\end{array}
(FPCore (x y z) :precision binary64 (* x (- 1.0 (* y z))))
(FPCore (x y z)
 :precision binary64
 (if (<= (* y z) 3.986975430109517e+271)
   (+ (* (- 1.0 (* y z)) x) (* x (fma (- z) y (* y z))))
   (- (* y (* z x)))))
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) <= 3.986975430109517e+271) {
		tmp = ((1.0 - (y * z)) * x) + (x * fma(-z, y, (y * z)));
	} else {
		tmp = -(y * (z * x));
	}
	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) < 3.98697543010951704e271

    1. Initial program 1.8

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

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

      \[\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_binary641.7

      \[\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. Taylor expanded in x around 0 1.7

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

    if 3.98697543010951704e271 < (*.f64 y z)

    1. Initial program 45.5

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot z \leq 3.986975430109517 \cdot 10^{+271}:\\ \;\;\;\;\left(1 - y \cdot z\right) \cdot x + x \cdot \mathsf{fma}\left(-z, y, y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;-y \cdot \left(z \cdot x\right)\\ \end{array} \]

Reproduce

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