Average Error: 0.2 → 0.1
Time: 20.0s
Precision: binary64
Cost: 448
\[\left(x \cdot 3\right) \cdot y - z\]
\[x \cdot \left(3 \cdot y\right) - z\]
\left(x \cdot 3\right) \cdot y - z
x \cdot \left(3 \cdot y\right) - z
(FPCore (x y z) :precision binary64 (- (* (* x 3.0) y) z))
(FPCore (x y z) :precision binary64 (- (* x (* 3.0 y)) z))
double code(double x, double y, double z) {
	return ((x * 3.0) * y) - z;
}
double code(double x, double y, double z) {
	return (x * (3.0 * 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

Target

Original0.2
Target0.1
Herbie0.1
\[x \cdot \left(3 \cdot y\right) - z\]
Alternative 1
Accuracy0.2
Cost448
\[\left(x \cdot 3\right) \cdot y - z\]

Derivation

  1. Initial program 0.2

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

    \[\leadsto \color{blue}{x \cdot \left(3 \cdot y\right)} - z\]
  4. Using strategy rm
  5. Applied sub-neg_binary64_208720.1

    \[\leadsto \color{blue}{x \cdot \left(3 \cdot y\right) + \left(-z\right)}\]
  6. Using strategy rm
  7. Applied pow1_binary64_209400.1

    \[\leadsto x \cdot \left(3 \cdot \color{blue}{{y}^{1}}\right) + \left(-z\right)\]
  8. Applied pow1_binary64_209400.1

    \[\leadsto x \cdot \left(\color{blue}{{3}^{1}} \cdot {y}^{1}\right) + \left(-z\right)\]
  9. Applied pow-prod-down_binary64_209500.1

    \[\leadsto x \cdot \color{blue}{{\left(3 \cdot y\right)}^{1}} + \left(-z\right)\]
  10. Applied pow1_binary64_209400.1

    \[\leadsto \color{blue}{{x}^{1}} \cdot {\left(3 \cdot y\right)}^{1} + \left(-z\right)\]
  11. Applied pow-prod-down_binary64_209500.1

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

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

Reproduce

herbie shell --seed 2020322 
(FPCore (x y z)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, B"
  :precision binary64

  :herbie-target
  (- (* x (* 3.0 y)) z)

  (- (* (* x 3.0) y) z))