Average Error: 3.4 → 0.4
Time: 5.5s
Precision: binary64
\[x \cdot \left(1 - y \cdot z\right)\]
\[\begin{array}{l} \mathbf{if}\;y \cdot z \leq -4.761941483808026 \cdot 10^{+261} \lor \neg \left(y \cdot z \leq 1.2191719913281072 \cdot 10^{+135}\right):\\ \;\;\;\;x - 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 -4.761941483808026 \cdot 10^{+261} \lor \neg \left(y \cdot z \leq 1.2191719913281072 \cdot 10^{+135}\right):\\
\;\;\;\;x - 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) -4.761941483808026e+261)
         (not (<= (* y z) 1.2191719913281072e+135)))
   (- x (* 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) <= -4.761941483808026e+261) || !((y * z) <= 1.2191719913281072e+135)) {
		tmp = x - (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) < -4.761941483808026e261 or 1.2191719913281072e135 < (*.f64 y z)

    1. Initial program 23.6

      \[x \cdot \left(1 - y \cdot z\right)\]
    2. Using strategy rm
    3. Applied sub-neg_binary64_689123.6

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

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

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

      \[\leadsto x + \color{blue}{\left(-x \cdot \left(z \cdot y\right)\right)}\]
    7. Using strategy rm
    8. Applied associate-*r*_binary64_68382.5

      \[\leadsto x + \left(-\color{blue}{\left(x \cdot z\right) \cdot y}\right)\]
    9. Using strategy rm
    10. Applied unsub-neg_binary64_68922.5

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

    if -4.761941483808026e261 < (*.f64 y z) < 1.2191719913281072e135

    1. Initial program 0.1

      \[x \cdot \left(1 - y \cdot z\right)\]
    2. Using strategy rm
    3. Applied sub-neg_binary64_68910.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot z \leq -4.761941483808026 \cdot 10^{+261} \lor \neg \left(y \cdot z \leq 1.2191719913281072 \cdot 10^{+135}\right):\\ \;\;\;\;x - y \cdot \left(z \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;x - \left(y \cdot z\right) \cdot x\\ \end{array}\]

Reproduce

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