\left(1 - x\right) \cdot y + x \cdot z
y + x \cdot \left(z - y\right)
(FPCore (x y z) :precision binary64 (+ (* (- 1.0 x) y) (* x z)))
(FPCore (x y z) :precision binary64 (+ y (* x (- z y))))
double code(double x, double y, double z) {
return ((1.0 - x) * y) + (x * z);
}
double code(double x, double y, double z) {
return y + (x * (z - y));
}











Bits error versus x











Bits error versus y











Bits error versus z
Results
| Original | 0.0 |
|---|---|
| Target | 0.0 |
| Herbie | 0.0 |
| Alternative 1 | |
|---|---|
| Error | 1.1 |
| Cost | 648 |
| Alternative 2 | |
|---|---|
| Error | 7.3 |
| Cost | 648 |
| Alternative 3 | |
|---|---|
| Error | 12.5 |
| Cost | 320 |
| Alternative 4 | |
|---|---|
| Error | 23.6 |
| Cost | 520 |
| Alternative 5 | |
|---|---|
| Error | 35.2 |
| Cost | 64 |
| Alternative 6 | |
|---|---|
| Error | 61.8 |
| Cost | 64 |
| Alternative 7 | |
|---|---|
| Error | 61.8 |
| Cost | 64 |

Initial program 0.0
Simplified0.0
Simplified0.0
Final simplification0.0
herbie shell --seed 2021044
(FPCore (x y z)
:name "Diagrams.Color.HSV:lerp from diagrams-contrib-1.3.0.5"
:precision binary64
:herbie-target
(- y (* x (- y z)))
(+ (* (- 1.0 x) y) (* x z)))