Average Error: 3.3 → 0.2
Time: 3.2s
Precision: binary64
\[x \cdot \left(1 - y \cdot z\right)\]
\[\begin{array}{l} \mathbf{if}\;y \cdot z \leq -5.366681610503205 \cdot 10^{+276} \lor \neg \left(y \cdot z \leq 4.817873197896677 \cdot 10^{+166}\right):\\ \;\;\;\;x - y \cdot \left(z \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 - y \cdot z\right)\\ \end{array}\]
x \cdot \left(1 - y \cdot z\right)
\begin{array}{l}
\mathbf{if}\;y \cdot z \leq -5.366681610503205 \cdot 10^{+276} \lor \neg \left(y \cdot z \leq 4.817873197896677 \cdot 10^{+166}\right):\\
\;\;\;\;x - y \cdot \left(z \cdot x\right)\\

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

\end{array}
(FPCore (x y z) :precision binary64 (* x (- 1.0 (* y z))))
(FPCore (x y z)
 :precision binary64
 (if (or (<= (* y z) -5.366681610503205e+276)
         (not (<= (* y z) 4.817873197896677e+166)))
   (- x (* y (* z x)))
   (* x (- 1.0 (* y 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 (((y * z) <= -5.366681610503205e+276) || !((y * z) <= 4.817873197896677e+166)) {
		tmp = x - (y * (z * x));
	} else {
		tmp = x * (1.0 - (y * 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 2 regimes
  2. if (*.f64 y z) < -5.36668161050320547e276 or 4.8178731978966771e166 < (*.f64 y z)

    1. Initial program 30.0

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

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

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

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

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

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

    if -5.36668161050320547e276 < (*.f64 y z) < 4.8178731978966771e166

    1. Initial program 0.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot z \leq -5.366681610503205 \cdot 10^{+276} \lor \neg \left(y \cdot z \leq 4.817873197896677 \cdot 10^{+166}\right):\\ \;\;\;\;x - y \cdot \left(z \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 - y \cdot z\right)\\ \end{array}\]

Alternatives

Reproduce

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