x \cdot \left(1 - \left(1 - y\right) \cdot z\right)
\begin{array}{l}
\mathbf{if}\;x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \leq -1.1353341014094774 \cdot 10^{+276} \lor \neg \left(x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \leq 8.254025059186815 \cdot 10^{-83}\right):\\
\;\;\;\;x + \left(x \cdot z\right) \cdot \left(y - 1\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(x \cdot \left(y \cdot z\right) - x \cdot z\right)\\
\end{array}(FPCore (x y z) :precision binary64 (* x (- 1.0 (* (- 1.0 y) z))))
(FPCore (x y z)
:precision binary64
(if (or (<= (* x (- 1.0 (* (- 1.0 y) z))) -1.1353341014094774e+276)
(not (<= (* x (- 1.0 (* (- 1.0 y) z))) 8.254025059186815e-83)))
(+ x (* (* x z) (- y 1.0)))
(+ x (- (* x (* y z)) (* x z)))))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 tmp;
if (((x * (1.0 - ((1.0 - y) * z))) <= -1.1353341014094774e+276) || !((x * (1.0 - ((1.0 - y) * z))) <= 8.254025059186815e-83)) {
tmp = x + ((x * z) * (y - 1.0));
} else {
tmp = x + ((x * (y * z)) - (x * z));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 3.6 |
|---|---|
| Target | 0.2 |
| Herbie | 0.2 |
if (*.f64 x (-.f64 1 (*.f64 (-.f64 1 y) z))) < -1.13533410140947738e276 or 8.254025059186815e-83 < (*.f64 x (-.f64 1 (*.f64 (-.f64 1 y) z))) Initial program 8.5
rmApplied sub-neg_binary64_232598.5
Applied distribute-rgt-in_binary64_232168.5
Simplified8.5
Simplified8.5
rmApplied *-un-lft-identity_binary64_232668.5
Applied distribute-rgt-out--_binary64_232208.5
Applied associate-*r*_binary64_232060.3
if -1.13533410140947738e276 < (*.f64 x (-.f64 1 (*.f64 (-.f64 1 y) z))) < 8.254025059186815e-83Initial program 0.1
rmApplied sub-neg_binary64_232590.1
Applied distribute-rgt-in_binary64_232160.1
Simplified0.1
Simplified0.1
rmApplied sub-neg_binary64_232590.1
Applied distribute-rgt-in_binary64_232160.1
Simplified0.1
Simplified0.1
Final simplification0.2
herbie shell --seed 2020339
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSV:hsv from colour-2.3.3, J"
:precision binary64
:herbie-target
(if (< (* x (- 1.0 (* (- 1.0 y) z))) -1.618195973607049e+50) (+ x (* (- 1.0 y) (* (- z) x))) (if (< (* x (- 1.0 (* (- 1.0 y) z))) 3.892237649663903e+134) (- (* (* x y) z) (- (* x z) x)) (+ x (* (- 1.0 y) (* (- z) x)))))
(* x (- 1.0 (* (- 1.0 y) z))))