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




Bits error versus x
| Original | 0.3 |
|---|---|
| Target | 0.2 |
| Herbie | 0.1 |
Initial program 0.3
Simplified0.2
Taylor expanded in x around 0 0.2
Applied fma-neg_binary640.1
Simplified0.1
Final simplification0.1
herbie shell --seed 2022067
(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))