\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x
\mathsf{fma}\left(x, 6, -9 \cdot {x}^{2}\right)double f(double x) {
double r500705 = 3.0;
double r500706 = 2.0;
double r500707 = x;
double r500708 = r500707 * r500705;
double r500709 = r500706 - r500708;
double r500710 = r500705 * r500709;
double r500711 = r500710 * r500707;
return r500711;
}
double f(double x) {
double r500712 = x;
double r500713 = 6.0;
double r500714 = 9.0;
double r500715 = 2.0;
double r500716 = pow(r500712, r500715);
double r500717 = r500714 * r500716;
double r500718 = -r500717;
double r500719 = fma(r500712, r500713, r500718);
return r500719;
}




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