Average Error: 3.1 → 0.8
Time: 3.1s
Precision: binary64
\[x \cdot \left(1 - y \cdot z\right)\]
\[\begin{array}{l} \mathbf{if}\;y \cdot z \leq -\infty:\\ \;\;\;\;x + \sqrt{-z} \cdot \left(\left(y \cdot x\right) \cdot \sqrt{-z}\right)\\ \mathbf{elif}\;y \cdot z \leq 1.4453866497451607 \cdot 10^{+234}:\\ \;\;\;\;x - \left(y \cdot z\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;x - z \cdot \left(y \cdot x\right)\\ \end{array}\]
x \cdot \left(1 - y \cdot z\right)
\begin{array}{l}
\mathbf{if}\;y \cdot z \leq -\infty:\\
\;\;\;\;x + \sqrt{-z} \cdot \left(\left(y \cdot x\right) \cdot \sqrt{-z}\right)\\

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

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

\end{array}
(FPCore (x y z) :precision binary64 (* x (- 1.0 (* y z))))
(FPCore (x y z)
 :precision binary64
 (if (<= (* y z) (- INFINITY))
   (+ x (* (sqrt (- z)) (* (* y x) (sqrt (- z)))))
   (if (<= (* y z) 1.4453866497451607e+234)
     (- x (* (* y z) x))
     (- x (* z (* y 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) <= -((double) INFINITY)) {
		tmp = x + (sqrt(-z) * ((y * x) * sqrt(-z)));
	} else if ((y * z) <= 1.4453866497451607e+234) {
		tmp = x - ((y * z) * x);
	} else {
		tmp = x - (z * (y * 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 3 regimes
  2. if (*.f64 y z) < -inf.0

    1. Initial program 64.0

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

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

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

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

      \[\leadsto x + \color{blue}{x \cdot \left(-y \cdot z\right)}\]
    7. Using strategy rm
    8. Applied distribute-rgt-neg-in_binary6464.0

      \[\leadsto x + x \cdot \color{blue}{\left(y \cdot \left(-z\right)\right)}\]
    9. Applied associate-*r*_binary640.3

      \[\leadsto x + \color{blue}{\left(x \cdot y\right) \cdot \left(-z\right)}\]
    10. Using strategy rm
    11. Applied add-sqr-sqrt_binary6430.8

      \[\leadsto x + \left(x \cdot y\right) \cdot \color{blue}{\left(\sqrt{-z} \cdot \sqrt{-z}\right)}\]
    12. Applied associate-*r*_binary6430.8

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

    if -inf.0 < (*.f64 y z) < 1.4453866497451607e234

    1. Initial program 0.1

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

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

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

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

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

    if 1.4453866497451607e234 < (*.f64 y z)

    1. Initial program 31.8

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

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

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

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

      \[\leadsto x + \color{blue}{x \cdot \left(-y \cdot z\right)}\]
    7. Using strategy rm
    8. Applied distribute-rgt-neg-in_binary6431.8

      \[\leadsto x + x \cdot \color{blue}{\left(y \cdot \left(-z\right)\right)}\]
    9. Applied associate-*r*_binary640.5

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

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

Reproduce

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