3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)
\mathsf{fma}\left(x, 9 \cdot x - 12, 3\right)double code(double x) {
return (3.0 * ((((x * 3.0) * x) - (x * 4.0)) + 1.0));
}
double code(double x) {
return fma(x, ((9.0 * x) - 12.0), 3.0);
}




Bits error versus x
Results
| Original | 0.1 |
|---|---|
| Target | 0.1 |
| Herbie | 0.1 |
Initial program 0.1
Simplified0.1
Taylor expanded around 0 0.1
Simplified0.1
Taylor expanded around 0 0.1
Simplified0.1
Final simplification0.1
herbie shell --seed 2020057 +o rules:numerics
(FPCore (x)
:name "Diagrams.Tangent:$catParam from diagrams-lib-1.3.0.3, D"
:precision binary64
:herbie-target
(+ 3 (- (* (* 9 x) x) (* 12 x)))
(* 3 (+ (- (* (* x 3) x) (* x 4)) 1)))