\left(3.0 \cdot \left(2.0 - x \cdot 3.0\right)\right) \cdot x
\mathsf{fma}\left(x, 6.0, -\left(x \cdot x\right) \cdot 9.0\right)double f(double x) {
double r28360940 = 3.0;
double r28360941 = 2.0;
double r28360942 = x;
double r28360943 = r28360942 * r28360940;
double r28360944 = r28360941 - r28360943;
double r28360945 = r28360940 * r28360944;
double r28360946 = r28360945 * r28360942;
return r28360946;
}
double f(double x) {
double r28360947 = x;
double r28360948 = 6.0;
double r28360949 = r28360947 * r28360947;
double r28360950 = 9.0;
double r28360951 = r28360949 * r28360950;
double r28360952 = -r28360951;
double r28360953 = fma(r28360947, r28360948, r28360952);
return r28360953;
}




Bits error versus x
| Original | 0.2 |
|---|---|
| Target | 0.2 |
| Herbie | 0.1 |
Initial program 0.2
rmApplied flip--0.3
Applied associate-*r/0.3
Taylor expanded around 0 0.2
Simplified0.2
rmApplied fma-neg0.1
Final simplification0.1
herbie shell --seed 2019158 +o rules:numerics
(FPCore (x)
:name "Diagrams.Tangent:$catParam from diagrams-lib-1.3.0.3, E"
:herbie-target
(- (* 6.0 x) (* 9.0 (* x x)))
(* (* 3.0 (- 2.0 (* x 3.0))) x))