x \cdot \left(1 - \left(1 - y\right) \cdot z\right)
\begin{array}{l}
\mathbf{if}\;x \le -9.0247081817427441 \cdot 10^{-170}:\\
\;\;\;\;x \cdot 1 + \left(x \cdot z\right) \cdot \left(y - 1\right)\\
\mathbf{elif}\;x \le 4.9259374917009595 \cdot 10^{-91}:\\
\;\;\;\;x \cdot 1 + {\left(\left(x \cdot \left(y - 1\right)\right) \cdot z\right)}^{1}\\
\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 f(double x, double y, double z) {
double r832656 = x;
double r832657 = 1.0;
double r832658 = y;
double r832659 = r832657 - r832658;
double r832660 = z;
double r832661 = r832659 * r832660;
double r832662 = r832657 - r832661;
double r832663 = r832656 * r832662;
return r832663;
}
double f(double x, double y, double z) {
double r832664 = x;
double r832665 = -9.024708181742744e-170;
bool r832666 = r832664 <= r832665;
double r832667 = 1.0;
double r832668 = r832664 * r832667;
double r832669 = z;
double r832670 = r832664 * r832669;
double r832671 = y;
double r832672 = r832671 - r832667;
double r832673 = r832670 * r832672;
double r832674 = r832668 + r832673;
double r832675 = 4.92593749170096e-91;
bool r832676 = r832664 <= r832675;
double r832677 = r832664 * r832672;
double r832678 = r832677 * r832669;
double r832679 = 1.0;
double r832680 = pow(r832678, r832679);
double r832681 = r832668 + r832680;
double r832682 = r832669 * r832671;
double r832683 = r832664 * r832682;
double r832684 = -r832667;
double r832685 = r832670 * r832684;
double r832686 = r832683 + r832685;
double r832687 = r832668 + r832686;
double r832688 = r832676 ? r832681 : r832687;
double r832689 = r832666 ? r832674 : r832688;
return r832689;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 3.3 |
|---|---|
| Target | 0.2 |
| Herbie | 0.4 |
if x < -9.024708181742744e-170Initial program 1.6
rmApplied sub-neg1.6
Applied distribute-lft-in1.6
Simplified0.4
if -9.024708181742744e-170 < x < 4.92593749170096e-91Initial program 7.2
rmApplied sub-neg7.2
Applied distribute-lft-in7.2
Simplified3.9
rmApplied add-cube-cbrt4.3
Applied associate-*r*4.3
rmApplied associate-*l*5.2
rmApplied pow15.2
Applied pow15.2
Applied pow15.2
Applied pow-prod-down5.2
Applied pow15.2
Applied pow-prod-down5.2
Applied pow15.2
Applied pow-prod-down5.2
Applied pow-prod-down5.2
Simplified0.1
if 4.92593749170096e-91 < x Initial program 0.8
rmApplied sub-neg0.8
Applied distribute-lft-in0.8
Simplified0.1
rmApplied sub-neg0.1
Applied distribute-lft-in0.1
Simplified0.8
Final simplification0.4
herbie shell --seed 2020021 +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))))