x \cdot \left(1 - \left(1 - y\right) \cdot z\right)
\begin{array}{l}
\mathbf{if}\;z \le -7173096633543.60449 \lor \neg \left(z \le 2.00548983557063586 \cdot 10^{114}\right):\\
\;\;\;\;x \cdot 1 + \left(x \cdot z\right) \cdot \left(y - 1\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1 + \left(x \cdot \left(z \cdot y\right) + \left(x \cdot z\right) \cdot \left(-1\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 <= -7173096633543.6045) || !(z <= 2.0054898355706359e+114))) {
temp = ((x * 1.0) + ((x * z) * (y - 1.0)));
} else {
temp = ((x * 1.0) + ((x * (z * y)) + ((x * z) * -1.0)));
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 3.5 |
|---|---|
| Target | 0.2 |
| Herbie | 0.4 |
if z < -7173096633543.6045 or 2.0054898355706359e+114 < z Initial program 10.8
rmApplied sub-neg10.8
Applied distribute-lft-in10.8
Simplified0.1
if -7173096633543.6045 < z < 2.0054898355706359e+114Initial program 0.5
rmApplied sub-neg0.5
Applied distribute-lft-in0.5
Simplified2.1
rmApplied sub-neg2.1
Applied distribute-lft-in2.1
Simplified0.5
Final simplification0.4
herbie shell --seed 2020060 +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))))