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




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 3.4 |
|---|---|
| Target | 0.2 |
| Herbie | 0.3 |
if x < -8.8603840443701918e89Initial program 0.1
rmApplied sub-neg_binary64_229180.1
Applied distribute-rgt-in_binary64_228750.1
if -8.8603840443701918e89 < x < 3.50938427057094256e-44Initial program 5.2
rmApplied sub-neg_binary64_229185.2
Applied distribute-rgt-in_binary64_228755.2
Simplified5.2
Simplified5.2
Taylor expanded around 0 0.3
if 3.50938427057094256e-44 < x Initial program 0.3
rmApplied sub-neg_binary64_229180.3
Applied distribute-rgt-in_binary64_228750.3
Simplified0.3
Simplified0.3
Final simplification0.3
herbie shell --seed 2021014
(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))))