\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x
\mathsf{fma}\left(6, x, \left(9 \cdot x\right) \cdot \left(-x\right)\right)double f(double x) {
double r32029358 = 3.0;
double r32029359 = 2.0;
double r32029360 = x;
double r32029361 = r32029360 * r32029358;
double r32029362 = r32029359 - r32029361;
double r32029363 = r32029358 * r32029362;
double r32029364 = r32029363 * r32029360;
return r32029364;
}
double f(double x) {
double r32029365 = 6.0;
double r32029366 = x;
double r32029367 = 9.0;
double r32029368 = r32029367 * r32029366;
double r32029369 = -r32029366;
double r32029370 = r32029368 * r32029369;
double r32029371 = fma(r32029365, r32029366, r32029370);
return r32029371;
}




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-rgt-in0.2
rmApplied fma-def0.1
Final simplification0.1
herbie shell --seed 2019168 +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))