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

Target

Original0.0
Target0.0
Herbie0.0
\[z - \left(z - x\right) \cdot y\]

Alternatives

Alternative 1
Error1.0
Cost648
\[\begin{array}{l} \mathbf{if}\;y \leq -258703.41134348375 \lor \neg \left(y \leq 0.9940110682950706\right):\\ \;\;\;\;y \cdot \left(x - z\right)\\ \mathbf{else}:\\ \;\;\;\;z + y \cdot x\\ \end{array}\]
Alternative 2
Error12.3
Cost648
\[\begin{array}{l} \mathbf{if}\;y \leq -1.1254590216590106 \cdot 10^{-05} \lor \neg \left(y \leq 6.892771576116899 \cdot 10^{-39}\right):\\ \;\;\;\;y \cdot \left(x - z\right)\\ \mathbf{else}:\\ \;\;\;\;z - z \cdot y\\ \end{array}\]
Alternative 3
Error12.4
Cost648
\[\begin{array}{l} \mathbf{if}\;y \leq -1.8363322705151943 \cdot 10^{-06} \lor \neg \left(y \leq 7.503859148524268 \cdot 10^{-39}\right):\\ \;\;\;\;y \cdot \left(x - z\right)\\ \mathbf{else}:\\ \;\;\;\;z\\ \end{array}\]
Alternative 4
Error23.8
Cost520
\[\begin{array}{l} \mathbf{if}\;y \leq -1.8363322705151943 \cdot 10^{-06} \lor \neg \left(y \leq 4.8702615084312675 \cdot 10^{-40}\right):\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;z\\ \end{array}\]
Alternative 5
Error35.0
Cost64
\[z\]
Alternative 6
Error61.8
Cost64
\[-1\]
Alternative 7
Error61.8
Cost64
\[1\]

Error

Derivation

  1. Initial program 0.0

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

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

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

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

Reproduce

herbie shell --seed 2021044 
(FPCore (x y z)
  :name "Diagrams.TwoD.Segment:bezierClip from diagrams-lib-1.3.0.3"
  :precision binary64

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

  (+ (* x y) (* z (- 1.0 y))))