Average Error: 0.1 → 0.1
Time: 3.9s
Precision: binary64
Cost: 832
\[\left(\left(x \cdot y + z \cdot z\right) + z \cdot z\right) + z \cdot z\]
\[z \cdot \left(z + z\right) + \left(z \cdot z + x \cdot y\right)\]
\left(\left(x \cdot y + z \cdot z\right) + z \cdot z\right) + z \cdot z
z \cdot \left(z + z\right) + \left(z \cdot z + x \cdot y\right)
(FPCore (x y z)
 :precision binary64
 (+ (+ (+ (* x y) (* z z)) (* z z)) (* z z)))
(FPCore (x y z) :precision binary64 (+ (* z (+ z z)) (+ (* z z) (* x y))))
double code(double x, double y, double z) {
	return (((x * y) + (z * z)) + (z * z)) + (z * z);
}
double code(double x, double y, double z) {
	return (z * (z + z)) + ((z * z) + (x * y));
}

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.1
Target0.1
Herbie0.1
\[\left(3 \cdot z\right) \cdot z + y \cdot x\]

Alternatives

Alternative 1
Error0.1
Cost576
\[x \cdot y + \left(z \cdot z\right) \cdot 3\]
Alternative 2
Error12.5
Cost2246
\[\begin{array}{l} \mathbf{if}\;z \leq -2.941569263356255 \cdot 10^{+83}:\\ \;\;\;\;z \cdot \left(z \cdot 3\right)\\ \mathbf{elif}\;z \leq -4.860094235806132 \cdot 10^{+65}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;z \leq -2098359403.335421:\\ \;\;\;\;\left(z \cdot z\right) \cdot 3\\ \mathbf{elif}\;z \leq -8.793719879826363 \cdot 10^{-130}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;z \leq -1.0889294763047725 \cdot 10^{-138}:\\ \;\;\;\;\left(z \cdot z\right) \cdot 3\\ \mathbf{elif}\;z \leq 1.918555859818006 \cdot 10^{-58}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(z \cdot 3\right)\\ \end{array}\]
Alternative 3
Error12.4
Cost1178
\[\begin{array}{l} \mathbf{if}\;z \leq -2.941569263356255 \cdot 10^{+83} \lor \neg \left(z \leq -4.860094235806132 \cdot 10^{+65} \lor \neg \left(z \leq -1712951.0384761482\right) \land \left(z \leq -8.793719879826363 \cdot 10^{-130} \lor \neg \left(z \leq -1.0889294763047725 \cdot 10^{-138}\right) \land z \leq 1.9806132739275406 \cdot 10^{-58}\right)\right):\\ \;\;\;\;\left(z \cdot z\right) \cdot 3\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array}\]
Alternative 4
Error23.8
Cost192
\[x \cdot y\]
Alternative 5
Error59.2
Cost64
\[0\]
Alternative 6
Error61.3
Cost64
\[1\]

Error

Derivation

  1. Initial program 0.1

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

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

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

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

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

Reproduce

herbie shell --seed 2021044 
(FPCore (x y z)
  :name "Linear.Quaternion:$c/ from linear-1.19.1.3, A"
  :precision binary64

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

  (+ (+ (+ (* x y) (* z z)) (* z z)) (* z z)))