Average Error: 3.4 → 0.3
Time: 4.2s
Precision: binary64
\[[y, z] = \mathsf{sort}([y, z]) \\]
\[x \cdot \left(1 - y \cdot z\right) \]
\[\begin{array}{l} t_0 := x \cdot \left(1 - y \cdot z\right)\\ \mathbf{if}\;t_0 \leq -\infty:\\ \;\;\;\;\left(-y\right) \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;t_0 \leq 1.658854212440669 \cdot 10^{+295}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;x - y \cdot \left(x \cdot z\right)\\ \end{array} \]
x \cdot \left(1 - y \cdot z\right)
\begin{array}{l}
t_0 := x \cdot \left(1 - y \cdot z\right)\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;\left(-y\right) \cdot \left(x \cdot z\right)\\

\mathbf{elif}\;t_0 \leq 1.658854212440669 \cdot 10^{+295}:\\
\;\;\;\;t_0\\

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


\end{array}
(FPCore (x y z) :precision binary64 (* x (- 1.0 (* y z))))
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (- 1.0 (* y z)))))
   (if (<= t_0 (- INFINITY))
     (* (- y) (* x z))
     (if (<= t_0 1.658854212440669e+295) t_0 (- x (* y (* x z)))))))
double code(double x, double y, double z) {
	return x * (1.0 - (y * z));
}
double code(double x, double y, double z) {
	double t_0 = x * (1.0 - (y * z));
	double tmp;
	if (t_0 <= -((double) INFINITY)) {
		tmp = -y * (x * z);
	} else if (t_0 <= 1.658854212440669e+295) {
		tmp = t_0;
	} else {
		tmp = x - (y * (x * z));
	}
	return tmp;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if (*.f64 x (-.f64 1 (*.f64 y z))) < -inf.0

    1. Initial program 64.0

      \[x \cdot \left(1 - y \cdot z\right) \]
    2. Applied add-cube-cbrt_binary6464.0

      \[\leadsto x \cdot \color{blue}{\left(\left(\sqrt[3]{1 - y \cdot z} \cdot \sqrt[3]{1 - y \cdot z}\right) \cdot \sqrt[3]{1 - y \cdot z}\right)} \]
    3. Applied associate-*r*_binary6464.0

      \[\leadsto \color{blue}{\left(x \cdot \left(\sqrt[3]{1 - y \cdot z} \cdot \sqrt[3]{1 - y \cdot z}\right)\right) \cdot \sqrt[3]{1 - y \cdot z}} \]
    4. Taylor expanded in y around inf 0.3

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

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

    if -inf.0 < (*.f64 x (-.f64 1 (*.f64 y z))) < 1.658854212440669e295

    1. Initial program 0.1

      \[x \cdot \left(1 - y \cdot z\right) \]

    if 1.658854212440669e295 < (*.f64 x (-.f64 1 (*.f64 y z)))

    1. Initial program 42.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot \left(1 - y \cdot z\right) \leq -\infty:\\ \;\;\;\;\left(-y\right) \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;x \cdot \left(1 - y \cdot z\right) \leq 1.658854212440669 \cdot 10^{+295}:\\ \;\;\;\;x \cdot \left(1 - y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x - y \cdot \left(x \cdot z\right)\\ \end{array} \]

Reproduce

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