\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x
\mathsf{fma}\left(6, x, -9 \cdot {x}^{2}\right)double f(double x) {
double r680926 = 3.0;
double r680927 = 2.0;
double r680928 = x;
double r680929 = r680928 * r680926;
double r680930 = r680927 - r680929;
double r680931 = r680926 * r680930;
double r680932 = r680931 * r680928;
return r680932;
}
double f(double x) {
double r680933 = 6.0;
double r680934 = x;
double r680935 = 9.0;
double r680936 = 2.0;
double r680937 = pow(r680934, r680936);
double r680938 = r680935 * r680937;
double r680939 = -r680938;
double r680940 = fma(r680933, r680934, r680939);
return r680940;
}




Bits error versus x
| Original | 0.3 |
|---|---|
| Target | 0.2 |
| Herbie | 0.1 |
Initial program 0.3
Taylor expanded around 0 0.2
Simplified0.2
rmApplied sub-neg0.2
Applied distribute-lft-in0.2
Simplified0.2
Simplified0.2
rmApplied fma-def0.1
Final simplification0.1
herbie shell --seed 2020047 +o rules:numerics
(FPCore (x)
:name "Diagrams.Tangent:$catParam from diagrams-lib-1.3.0.3, E"
:precision binary64
:herbie-target
(- (* 6 x) (* 9 (* x x)))
(* (* 3 (- 2 (* x 3))) x))