Average Error: 3.4 → 0.2
Time: 4.6s
Precision: binary64
Cost: 1032
\[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 8.455323020365894 \cdot 10^{+212}\right):\\ \;\;\;\;\left(y \cdot x\right) \cdot \left(-z\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 8.455323020365894 \cdot 10^{+212}\right):\\
\;\;\;\;\left(y \cdot x\right) \cdot \left(-z\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) 8.455323020365894e+212)))
   (* (* y x) (- z))
   (- 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) <= 8.455323020365894e+212)) {
		tmp = (y * x) * -z;
	} 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

Alternatives

Alternative 1
Error4.8
Cost769
\[\begin{array}{l} \mathbf{if}\;x \leq 9.576242457062901 \cdot 10^{+194}:\\ \;\;\;\;x - z \cdot \left(y \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array}\]
Alternative 2
Error20.0
Cost1807
\[\begin{array}{l} \mathbf{if}\;y \leq -3.853343159141216 \cdot 10^{+128}:\\ \;\;\;\;\left(y \cdot x\right) \cdot \left(-z\right)\\ \mathbf{elif}\;y \leq -0.05614541918660794:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -1.1738222486998648 \cdot 10^{-55}:\\ \;\;\;\;x \cdot \left(y \cdot \left(-z\right)\right)\\ \mathbf{elif}\;y \leq 2.323875862690112 \cdot 10^{+56} \lor \neg \left(y \leq 1.4226742386985466 \cdot 10^{+122}\right) \land y \leq 2.5282516044169336 \cdot 10^{+158}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot x\right) \cdot \left(-z\right)\\ \end{array}\]
Alternative 3
Error20.0
Cost1242
\[\begin{array}{l} \mathbf{if}\;y \leq -3.432333500209302 \cdot 10^{+129} \lor \neg \left(y \leq -7468.539230237898 \lor \neg \left(y \leq -5.886549832220981 \cdot 10^{-54}\right) \land \left(y \leq 2.033610237273138 \cdot 10^{+56} \lor \neg \left(y \leq 1.0934844283865573 \cdot 10^{+117}\right) \land y \leq 4.370210639005896 \cdot 10^{+158}\right)\right):\\ \;\;\;\;\left(y \cdot x\right) \cdot \left(-z\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array}\]
Alternative 4
Error25.9
Cost64
\[x\]
Alternative 5
Error61.8
Cost64
\[1\]

Error

Derivation

  1. Split input into 2 regimes
  2. if (*.f64 y z) < -4.761941483808026e261 or 8.45532302036589439e212 < (*.f64 y z)

    1. Initial program 33.4

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

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

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

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

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

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

      \[\leadsto x + \color{blue}{\left(x \cdot y\right) \cdot \left(-z\right)}\]
    10. Taylor expanded around inf 33.4

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

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

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

    if -4.761941483808026e261 < (*.f64 y z) < 8.45532302036589439e212

    1. Initial program 0.1

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

      \[\leadsto x \cdot \color{blue}{\left(1 + \left(-y \cdot z\right)\right)}\]
    4. Applied distribute-rgt-in_binary64_82120.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)}\]
    7. Simplified0.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot z \leq -4.761941483808026 \cdot 10^{+261} \lor \neg \left(y \cdot z \leq 8.455323020365894 \cdot 10^{+212}\right):\\ \;\;\;\;\left(y \cdot x\right) \cdot \left(-z\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))))