Average Error: 0.0 → 0.0
Time: 2.2s
Precision: binary64
\[x \cdot y + \left(1 - x\right) \cdot z\]
\[1 \cdot \left(z + x \cdot \left(y - z\right)\right)\]
x \cdot y + \left(1 - x\right) \cdot z
1 \cdot \left(z + x \cdot \left(y - z\right)\right)
(FPCore (x y z) :precision binary64 (+ (* x y) (* (- 1.0 x) z)))
(FPCore (x y z) :precision binary64 (* 1.0 (+ z (* x (- y z)))))
double code(double x, double y, double z) {
	return ((double) (((double) (x * y)) + ((double) (((double) (1.0 - x)) * z))));
}
double code(double x, double y, double z) {
	return ((double) (1.0 * ((double) (z + ((double) (x * ((double) (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

Derivation

  1. Initial program 0.0

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

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

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

    \[\leadsto \frac{x \cdot \left(x \cdot \left(y \cdot y\right)\right) + \left(1 - x\right) \cdot \left(z \cdot \left(z \cdot \left(x - 1\right)\right)\right)}{\color{blue}{x \cdot y + z \cdot \left(x - 1\right)}}\]
  6. Taylor expanded around 0 0.0

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

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

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

Reproduce

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