x \cdot \left(1 - \left(1 - y\right) \cdot z\right)
\begin{array}{l}
\mathbf{if}\;x \le -2.5086720243577012 \cdot 10^{74} \lor \neg \left(x \le 4.82713285845016858 \cdot 10^{-220}\right):\\
\;\;\;\;\mathsf{fma}\left(1, x, \left(x \cdot z\right) \cdot \left(y - 1\right)\right)\\
\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 ((double) (x * ((double) (1.0 - ((double) (((double) (1.0 - y)) * z))))));
}
double code(double x, double y, double z) {
double VAR;
if (((x <= -2.508672024357701e+74) || !(x <= 4.8271328584501686e-220))) {
VAR = ((double) fma(1.0, x, ((double) (((double) (x * z)) * ((double) (y - 1.0))))));
} else {
VAR = ((double) fma(1.0, x, ((double) (z * ((double) (x * ((double) (y - 1.0))))))));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 3.5 |
|---|---|
| Target | 0.3 |
| Herbie | 0.5 |
if x < -2.508672024357701e+74 or 4.8271328584501686e-220 < x Initial program 2.0
Taylor expanded around inf 2.0
Simplified0.6
if -2.508672024357701e+74 < x < 4.8271328584501686e-220Initial program 5.4
Taylor expanded around inf 5.4
Simplified2.4
rmApplied *-commutative2.4
Applied associate-*l*0.4
Final simplification0.5
herbie shell --seed 2020113 +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))))