3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)
3 + \mathsf{fma}\left(x, 9 \cdot x, x \cdot \left(-12\right)\right)double f(double x) {
double r1154225 = 3.0;
double r1154226 = x;
double r1154227 = r1154226 * r1154225;
double r1154228 = r1154227 * r1154226;
double r1154229 = 4.0;
double r1154230 = r1154226 * r1154229;
double r1154231 = r1154228 - r1154230;
double r1154232 = 1.0;
double r1154233 = r1154231 + r1154232;
double r1154234 = r1154225 * r1154233;
return r1154234;
}
double f(double x) {
double r1154235 = 3.0;
double r1154236 = x;
double r1154237 = 9.0;
double r1154238 = r1154237 * r1154236;
double r1154239 = 12.0;
double r1154240 = -r1154239;
double r1154241 = r1154236 * r1154240;
double r1154242 = fma(r1154236, r1154238, r1154241);
double r1154243 = r1154235 + r1154242;
return r1154243;
}




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