\left(3.0 \cdot \left(2.0 - x \cdot 3.0\right)\right) \cdot x
\mathsf{fma}\left(6.0, x, \left(x \cdot x\right) \cdot -9.0\right)double f(double x) {
double r33419799 = 3.0;
double r33419800 = 2.0;
double r33419801 = x;
double r33419802 = r33419801 * r33419799;
double r33419803 = r33419800 - r33419802;
double r33419804 = r33419799 * r33419803;
double r33419805 = r33419804 * r33419801;
return r33419805;
}
double f(double x) {
double r33419806 = 6.0;
double r33419807 = x;
double r33419808 = r33419807 * r33419807;
double r33419809 = -9.0;
double r33419810 = r33419808 * r33419809;
double r33419811 = fma(r33419806, r33419807, r33419810);
return r33419811;
}




Bits error versus x
| Original | 0.2 |
|---|---|
| Target | 0.2 |
| Herbie | 0.1 |
Initial program 0.2
Taylor expanded around 0 0.2
Simplified0.2
rmApplied sub-neg0.2
Applied distribute-rgt-in0.2
rmApplied fma-def0.1
Taylor expanded around 0 0.1
Simplified0.1
Final simplification0.1
herbie shell --seed 2019164 +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))