x \cdot \left(1 - \left(1 - y\right) \cdot z\right)
\begin{array}{l}
\mathbf{if}\;\left(1 - y\right) \cdot z \le -6.25037762144038382 \cdot 10^{116}:\\
\;\;\;\;1 \cdot x + z \cdot \left(\left(y - 1\right) \cdot x\right)\\
\mathbf{elif}\;\left(1 - y\right) \cdot z \le 2.2478684520799233 \cdot 10^{172}:\\
\;\;\;\;x \cdot \left(1 - \left(1 - y\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot z\right) \cdot \left(y - 1\right) + x \cdot 1\\
\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 ((((double) (((double) (1.0 - y)) * z)) <= -6.250377621440384e+116)) {
VAR = ((double) (((double) (1.0 * x)) + ((double) (z * ((double) (((double) (y - 1.0)) * x))))));
} else {
double VAR_1;
if ((((double) (((double) (1.0 - y)) * z)) <= 2.2478684520799233e+172)) {
VAR_1 = ((double) (x * ((double) (1.0 - ((double) (((double) (1.0 - y)) * z))))));
} else {
VAR_1 = ((double) (((double) (((double) (x * z)) * ((double) (y - 1.0)))) + ((double) (x * 1.0))));
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 3.6 |
|---|---|
| Target | 0.3 |
| Herbie | 0.4 |
if (* (- 1.0 y) z) < -6.25037762144038382e116Initial program 11.1
rmApplied sub-neg11.1
Applied distribute-lft-in11.1
Simplified11.1
Simplified1.4
if -6.25037762144038382e116 < (* (- 1.0 y) z) < 2.2478684520799233e172Initial program 0.1
if 2.2478684520799233e172 < (* (- 1.0 y) z) Initial program 15.6
Taylor expanded around inf 15.6
Simplified0.8
Final simplification0.4
herbie shell --seed 2020182
(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) (* (neg z) x))) (if (< (* x (- 1.0 (* (- 1.0 y) z))) 3.892237649663903e+134) (- (* (* x y) z) (- (* x z) x)) (+ x (* (- 1.0 y) (* (neg z) x)))))
(* x (- 1.0 (* (- 1.0 y) z))))