Average Error: 3.1 → 1.8
Time: 1.5min
Precision: binary64
Cost: 897
\[x \cdot \left(1 - y \cdot z\right)\]
\[\begin{array}{l} \mathbf{if}\;y \cdot z \leq -3.942509401165715 \cdot 10^{+165}:\\ \;\;\;\;\left(-z\right) \cdot \left(y \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 -3.942509401165715 \cdot 10^{+165}:\\
\;\;\;\;\left(-z\right) \cdot \left(y \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 (<= (* y z) -3.942509401165715e+165)
   (* (- z) (* y 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) <= -3.942509401165715e+165) {
		tmp = -z * (y * 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

Alternatives

Alternative 1
Error20.0
Cost977
\[\begin{array}{l} \mathbf{if}\;y \leq -9.368162236877668 \cdot 10^{+168} \lor \neg \left(y \leq -621.0480924154341 \lor \neg \left(y \leq -1.5130817828611212 \cdot 10^{-41}\right) \land y \leq 8.385375124372152 \cdot 10^{-10}\right):\\ \;\;\;\;\left(-z\right) \cdot \left(y \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array}\]
Alternative 2
Error21.6
Cost977
\[\begin{array}{l} \mathbf{if}\;y \leq -5.4044451224389 \cdot 10^{+178} \lor \neg \left(y \leq -5037.865124839786 \lor \neg \left(y \leq -1.309902677883514 \cdot 10^{-41}\right) \land y \leq 6.139300952328164 \cdot 10^{-09}\right):\\ \;\;\;\;x \cdot \left(y \cdot \left(-z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array}\]
Alternative 3
Error25.4
Cost64
\[x\]

Error

Time

Derivation

  1. Split input into 2 regimes
  2. if (*.f64 y z) < -3.94250940116571467e165

    1. Initial program 19.2

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

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

      \[\leadsto \color{blue}{x \cdot \left(-y \cdot z\right)}\]
    4. Using strategy rm
    5. Applied distribute-rgt-neg-in_binary64_992519.2

      \[\leadsto x \cdot \color{blue}{\left(y \cdot \left(-z\right)\right)}\]
    6. Applied associate-*r*_binary64_99072.0

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

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

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

    if -3.94250940116571467e165 < (*.f64 y z)

    1. Initial program 1.8

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

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

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

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

Reproduce

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