x \cdot \left(1 - \left(1 - y\right) \cdot z\right)
\begin{array}{l}
\mathbf{if}\;z \leq -5.2458616075492657 \cdot 10^{+166}:\\
\;\;\;\;\left(y - 1\right) \cdot \left(z \cdot x\right)\\
\mathbf{elif}\;z \leq 1.1574701340110282 \cdot 10^{-107}:\\
\;\;\;\;\left(x + x \cdot \left(z \cdot y\right)\right) - z \cdot x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y \cdot x - x\right)\\
\end{array}(FPCore (x y z) :precision binary64 (* x (- 1.0 (* (- 1.0 y) z))))
(FPCore (x y z)
:precision binary64
(if (<= z -5.2458616075492657e+166)
(* (- y 1.0) (* z x))
(if (<= z 1.1574701340110282e-107)
(- (+ x (* x (* z y))) (* z x))
(+ x (* z (- (* y x) x))))))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 (z <= -5.2458616075492657e+166) {
tmp = (y - 1.0) * (z * x);
} else if (z <= 1.1574701340110282e-107) {
tmp = (x + (x * (z * y))) - (z * x);
} else {
tmp = x + (z * ((y * x) - x));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 3.6 |
|---|---|
| Target | 0.2 |
| Herbie | 0.9 |
if z < -5.2458616075492657e166Initial program 16.3
rmApplied add-cube-cbrt_binary6417.2
Simplified17.2
Simplified17.2
Taylor expanded around inf 16.3
Simplified0.1
if -5.2458616075492657e166 < z < 1.15747013401102817e-107Initial program 1.0
Taylor expanded around 0 0.9
if 1.15747013401102817e-107 < z Initial program 6.2
rmApplied add-cube-cbrt_binary646.9
Simplified6.9
Simplified6.9
rmApplied sub-neg_binary646.9
Applied distribute-rgt-in_binary646.9
Simplified6.9
Simplified0.7
Taylor expanded around 0 1.1
Final simplification0.9
herbie shell --seed 2021175
(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))))