x \cdot \left(1 - \left(1 - y\right) \cdot z\right)
\begin{array}{l}
\mathbf{if}\;z \le -2.3306712281846513 \cdot 10^{-90}:\\
\;\;\;\;\mathsf{fma}\left(1, x, \left(x \cdot z\right) \cdot \left(y - 1\right)\right)\\
\mathbf{elif}\;z \le 4.26612945255824409 \cdot 10^{-114}:\\
\;\;\;\;\left(1 - \left(1 - y\right) \cdot z\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1, x, z \cdot \left(x \cdot \left(y - 1\right)\right)\right)\\
\end{array}double code(double x, double y, double z) {
return (x * (1.0 - ((1.0 - y) * z)));
}
double code(double x, double y, double z) {
double temp;
if ((z <= -2.3306712281846513e-90)) {
temp = fma(1.0, x, ((x * z) * (y - 1.0)));
} else {
double temp_1;
if ((z <= 4.266129452558244e-114)) {
temp_1 = ((1.0 - ((1.0 - y) * z)) * x);
} else {
temp_1 = fma(1.0, x, (z * (x * (y - 1.0))));
}
temp = temp_1;
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 2.8 |
|---|---|
| Target | 0.2 |
| Herbie | 0.5 |
if z < -2.3306712281846513e-90Initial program 4.7
Taylor expanded around inf 4.7
Simplified0.5
if -2.3306712281846513e-90 < z < 4.266129452558244e-114Initial program 0.0
rmApplied *-commutative0.0
if 4.266129452558244e-114 < z Initial program 5.1
Taylor expanded around inf 5.0
Simplified0.9
rmApplied *-commutative0.9
Applied associate-*l*1.0
Final simplification0.5
herbie shell --seed 2020066 +o rules:numerics
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSV:hsv from colour-2.3.3, J"
:precision binary64
:herbie-target
(if (< (* x (- 1 (* (- 1 y) z))) -1.618195973607049e+50) (+ x (* (- 1 y) (* (- z) x))) (if (< (* x (- 1 (* (- 1 y) z))) 3.892237649663903e+134) (- (* (* x y) z) (- (* x z) x)) (+ x (* (- 1 y) (* (- z) x)))))
(* x (- 1 (* (- 1 y) z))))