Average Error: 0.0 → 0.0
Time: 2.4s
Precision: binary64
\[x + \left(y - x\right) \cdot z\]
\[x + \left(y \cdot z - x \cdot z\right)\]
x + \left(y - x\right) \cdot z
x + \left(y \cdot z - x \cdot z\right)
double code(double x, double y, double z) {
	return ((double) (x + ((double) (((double) (y - x)) * z))));
}
double code(double x, double y, double z) {
	return ((double) (x + ((double) (((double) (y * z)) - ((double) (x * 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 + \left(y - x\right) \cdot z\]
  2. Using strategy rm
  3. Applied flip--24.6

    \[\leadsto x + \color{blue}{\frac{y \cdot y - x \cdot x}{y + x}} \cdot z\]
  4. Applied associate-*l/28.4

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

    \[\leadsto x + \frac{\color{blue}{\left(y - x\right) \cdot \left(z \cdot \left(y + x\right)\right)}}{y + x}\]
  6. Using strategy rm
  7. Applied associate-/l*0.1

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

    \[\leadsto x + \frac{y - x}{\color{blue}{\frac{1}{z}}}\]
  9. Using strategy rm
  10. Applied div-sub0.2

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

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

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

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

Reproduce

herbie shell --seed 2020181 
(FPCore (x y z)
  :name "Diagrams.ThreeD.Shapes:frustum from diagrams-lib-1.3.0.3, B"
  :precision binary64
  (+ x (* (- y x) z)))