Average Error: 3.5 → 0.1
Time: 3.1s
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 -5.516464170709737 \cdot 10^{+285} \lor \neg \left(y \cdot z \leq 3.607945691849598 \cdot 10^{+249}\right):\\ \;\;\;\;-y \cdot \left(z \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;x - \left(y \cdot z\right) \cdot x\\ \end{array} \]
x \cdot \left(1 - y \cdot z\right)
\begin{array}{l}
\mathbf{if}\;y \cdot z \leq -5.516464170709737 \cdot 10^{+285} \lor \neg \left(y \cdot z \leq 3.607945691849598 \cdot 10^{+249}\right):\\
\;\;\;\;-y \cdot \left(z \cdot x\right)\\

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


\end{array}
(FPCore (x y z) :precision binary64 (* x (- 1.0 (* y z))))
(FPCore (x y z)
 :precision binary64
 (if (or (<= (* y z) -5.516464170709737e+285)
         (not (<= (* y z) 3.607945691849598e+249)))
   (- (* y (* z x)))
   (- x (* (* 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) <= -5.516464170709737e+285) || !((y * z) <= 3.607945691849598e+249)) {
		tmp = -(y * (z * x));
	} else {
		tmp = x - ((y * z) * x);
	}
	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 2 regimes
  2. if (*.f64 y z) < -5.51646417070973743e285 or 3.6079456918495983e249 < (*.f64 y z)

    1. Initial program 44.5

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

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

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

    if -5.51646417070973743e285 < (*.f64 y z) < 3.6079456918495983e249

    1. Initial program 0.1

      \[x \cdot \left(1 - y \cdot z\right) \]
    2. Applied sub-neg_binary640.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot z \leq -5.516464170709737 \cdot 10^{+285} \lor \neg \left(y \cdot z \leq 3.607945691849598 \cdot 10^{+249}\right):\\ \;\;\;\;-y \cdot \left(z \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;x - \left(y \cdot z\right) \cdot x\\ \end{array} \]

Reproduce

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