\frac{x + y \cdot \left(z - x\right)}{z}
\mathsf{fma}\left(\frac{x}{z}, 1 - y, y\right)
(FPCore (x y z) :precision binary64 (/ (+ x (* y (- z x))) z))
(FPCore (x y z) :precision binary64 (fma (/ x z) (- 1.0 y) y))
double code(double x, double y, double z) {
return (x + (y * (z - x))) / z;
}
double code(double x, double y, double z) {
return fma((x / z), (1.0 - y), y);
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 7.2 |
|---|---|
| Target | 3.8 |
| Herbie | 0.0 |
Initial program 7.2
Simplified7.2
Applied *-un-lft-identity_binary647.2
Applied *-un-lft-identity_binary647.2
Applied times-frac_binary647.2
Simplified7.2
Simplified2.7
Taylor expanded in y around 0 5.0
Simplified0.0
Final simplification0.0
herbie shell --seed 2022068
(FPCore (x y z)
:name "Diagrams.Backend.Rasterific:rasterificRadialGradient from diagrams-rasterific-1.3.1.3"
:precision binary64
:herbie-target
(- (+ y (/ x z)) (/ y (/ z x)))
(/ (+ x (* y (- z x))) z))