\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120\mathsf{fma}\left(120, a, 60 \cdot \left(\frac{x}{z - t} - \frac{y}{z - t}\right)\right)double code(double x, double y, double z, double t, double a) {
return (((60.0 * (x - y)) / (z - t)) + (a * 120.0));
}
double code(double x, double y, double z, double t, double a) {
return fma(120.0, a, (60.0 * ((x / (z - t)) - (y / (z - t)))));
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
Results
| Original | 0.5 |
|---|---|
| Target | 0.2 |
| Herbie | 0.1 |
Initial program 0.5
Simplified0.5
rmApplied *-un-lft-identity0.5
Applied times-frac0.1
Simplified0.1
rmApplied div-sub0.1
Final simplification0.1
herbie shell --seed 2020102 +o rules:numerics
(FPCore (x y z t a)
:name "Data.Colour.RGB:hslsv from colour-2.3.3, B"
:precision binary64
:herbie-target
(+ (/ 60 (/ (- z t) (- x y))) (* a 120))
(+ (/ (* 60 (- x y)) (- z t)) (* a 120)))