\left(d1 \cdot 10 + d1 \cdot d2\right) + d1 \cdot 20
d1 \cdot \mathsf{fma}\left(\sqrt{20}, \sqrt{20}, 10 + d2\right)double f(double d1, double d2) {
double r28376 = d1;
double r28377 = 10.0;
double r28378 = r28376 * r28377;
double r28379 = d2;
double r28380 = r28376 * r28379;
double r28381 = r28378 + r28380;
double r28382 = 20.0;
double r28383 = r28376 * r28382;
double r28384 = r28381 + r28383;
return r28384;
}
double f(double d1, double d2) {
double r28385 = d1;
double r28386 = 20.0;
double r28387 = sqrt(r28386);
double r28388 = 10.0;
double r28389 = d2;
double r28390 = r28388 + r28389;
double r28391 = fma(r28387, r28387, r28390);
double r28392 = r28385 * r28391;
return r28392;
}




Bits error versus d1




Bits error versus d2
| Original | 0.2 |
|---|---|
| Target | 0.0 |
| Herbie | 0.4 |
Initial program 0.2
Simplified0.0
rmApplied add-sqr-sqrt0.4
Applied fma-def0.4
Final simplification0.4
herbie shell --seed 2020045 +o rules:numerics
(FPCore (d1 d2)
:name "FastMath test2"
:precision binary64
:herbie-target
(* d1 (+ 30 d2))
(+ (+ (* d1 10) (* d1 d2)) (* d1 20)))