Average Error: 3.4 → 0.1
Time: 7.4s
Precision: binary64
\[x \cdot \left(1 - y \cdot z\right)\]
\[\begin{array}{l} \mathbf{if}\;x \cdot \left(1 - y \cdot z\right) \leq -\infty:\\ \;\;\;\;z \cdot \left(x \cdot \left(-y\right)\right)\\ \mathbf{elif}\;x \cdot \left(1 - y \cdot z\right) \leq 7.270083822933438 \cdot 10^{+307}:\\ \;\;\;\;x - x \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x - y \cdot \left(x \cdot z\right)\\ \end{array}\]
x \cdot \left(1 - y \cdot z\right)
\begin{array}{l}
\mathbf{if}\;x \cdot \left(1 - y \cdot z\right) \leq -\infty:\\
\;\;\;\;z \cdot \left(x \cdot \left(-y\right)\right)\\

\mathbf{elif}\;x \cdot \left(1 - y \cdot z\right) \leq 7.270083822933438 \cdot 10^{+307}:\\
\;\;\;\;x - x \cdot \left(y \cdot z\right)\\

\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
 (if (<= (* x (- 1.0 (* y z))) (- INFINITY))
   (* z (* x (- y)))
   (if (<= (* x (- 1.0 (* y z))) 7.270083822933438e+307)
     (- x (* x (* y z)))
     (- 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 tmp;
	if ((x * (1.0 - (y * z))) <= -((double) INFINITY)) {
		tmp = z * (x * -y);
	} else if ((x * (1.0 - (y * z))) <= 7.270083822933438e+307) {
		tmp = x - (x * (y * z));
	} 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. Taylor expanded around inf 64.0

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

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

    if -inf.0 < (*.f64 x (-.f64 1 (*.f64 y z))) < 7.2700838229334382e307

    1. Initial program 0.1

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

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

    if 7.2700838229334382e307 < (*.f64 x (-.f64 1 (*.f64 y z)))

    1. Initial program 63.1

      \[x \cdot \left(1 - y \cdot z\right)\]
    2. Simplified0.3

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

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

Reproduce

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