Average Error: 0.0 → 0.0
Time: 2.2s
Precision: binary64
Cost: 448
\[x \cdot y + \left(1 - x\right) \cdot z\]
\[z + x \cdot \left(y - z\right)\]
x \cdot y + \left(1 - x\right) \cdot z
z + x \cdot \left(y - z\right)
(FPCore (x y z) :precision binary64 (+ (* x y) (* (- 1.0 x) z)))
(FPCore (x y z) :precision binary64 (+ z (* x (- y z))))
double code(double x, double y, double z) {
	return (x * y) + ((1.0 - x) * z);
}
double code(double x, double y, double z) {
	return z + (x * (y - z));
}

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
Error0.9
Cost648
\[\begin{array}{l} \mathbf{if}\;x \leq -1.0179197843179981 \lor \neg \left(x \leq 1.0052300524033566\right):\\ \;\;\;\;x \cdot \left(y - z\right)\\ \mathbf{else}:\\ \;\;\;\;z + x \cdot y\\ \end{array}\]
Alternative 2
Error7.3
Cost648
\[\begin{array}{l} \mathbf{if}\;y \leq -1.3606815947832856 \cdot 10^{-36} \lor \neg \left(y \leq 2.680968823381899 \cdot 10^{-119}\right):\\ \;\;\;\;z + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;z - z \cdot x\\ \end{array}\]
Alternative 3
Error19.4
Cost648
\[\begin{array}{l} \mathbf{if}\;y \leq -1.4044500984613913 \cdot 10^{-10} \lor \neg \left(y \leq 3.411503740634102 \cdot 10^{+182}\right):\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;z - z \cdot x\\ \end{array}\]
Alternative 4
Error24.0
Cost520
\[\begin{array}{l} \mathbf{if}\;x \leq -3.699130614284563 \cdot 10^{-19} \lor \neg \left(x \leq 1.5652421734300902 \cdot 10^{-44}\right):\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;z\\ \end{array}\]
Alternative 5
Error35.7
Cost64
\[z\]
Alternative 6
Error61.8
Cost64
\[1\]

Error

Derivation

  1. Initial program 0.0

    \[x \cdot y + \left(1 - x\right) \cdot z\]
  2. Simplified0.0

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

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

    \[\leadsto z + x \cdot \left(y - z\right)\]

Reproduce

herbie shell --seed 2021044 
(FPCore (x y z)
  :name "Diagrams.Backend.Rasterific:$crender from diagrams-rasterific-1.3.1.3"
  :precision binary64
  (+ (* x y) (* (- 1.0 x) z)))