\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x
x \cdot \left(6 + x \cdot -9\right)
(FPCore (x) :precision binary64 (* (* 3.0 (- 2.0 (* x 3.0))) x))
(FPCore (x) :precision binary64 (* x (+ 6.0 (* x -9.0))))
double code(double x) {
return (3.0 * (2.0 - (x * 3.0))) * x;
}
double code(double x) {
return x * (6.0 + (x * -9.0));
}









Bits error versus x
Results
| Original | 0.3 |
|---|---|
| Target | 0.2 |
| Herbie | 0.2 |
| Alternative 1 | |
|---|---|
| Error | 2.0 |
| Cost | 648 |
| Alternative 2 | |
|---|---|
| Error | 22.0 |
| Cost | 192 |
| Alternative 3 | |
|---|---|
| Error | 61.2 |
| Cost | 64 |
| Alternative 4 | |
|---|---|
| Error | 61.3 |
| Cost | 64 |
| Alternative 5 | |
|---|---|
| Error | 62.2 |
| Cost | 64 |

Initial program 0.3
Simplified0.2
Simplified0.2
Final simplification0.2
herbie shell --seed 2021044
(FPCore (x)
:name "Diagrams.Tangent:$catParam from diagrams-lib-1.3.0.3, E"
:precision binary64
:herbie-target
(- (* 6.0 x) (* 9.0 (* x x)))
(* (* 3.0 (- 2.0 (* x 3.0))) x))