x \cdot \left(1 - \left(1 - y\right) \cdot z\right)
\begin{array}{l}
\mathbf{if}\;\left(1 - y\right) \cdot z \le -1.78066746148344196 \cdot 10^{255}:\\
\;\;\;\;x \cdot 1 + z \cdot \left(\left(y - 1\right) \cdot x\right)\\
\mathbf{elif}\;\left(1 - y\right) \cdot z \le 9.59721426538854149 \cdot 10^{74}:\\
\;\;\;\;x \cdot 1 + \left(z \cdot \left(y - 1\right)\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1 + \left(x \cdot z\right) \cdot \left(y - 1\right)\\
\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)) <= -1.780667461483442e+255)) {
VAR = ((double) (((double) (x * 1.0)) + ((double) (z * ((double) (((double) (y - 1.0)) * x))))));
} else {
double VAR_1;
if ((((double) (((double) (1.0 - y)) * z)) <= 9.597214265388541e+74)) {
VAR_1 = ((double) (((double) (x * 1.0)) + ((double) (((double) (z * ((double) (y - 1.0)))) * x))));
} else {
VAR_1 = ((double) (((double) (x * 1.0)) + ((double) (((double) (x * z)) * ((double) (y - 1.0))))));
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 3.5 |
|---|---|
| Target | 0.2 |
| Herbie | 0.4 |
if (* (- 1.0 y) z) < -1.78066746148344196e255Initial program 32.2
rmApplied sub-neg32.2
Applied distribute-lft-in32.2
Simplified32.2
rmApplied associate-*l*0.2
if -1.78066746148344196e255 < (* (- 1.0 y) z) < 9.59721426538854149e74Initial program 0.1
rmApplied sub-neg0.1
Applied distribute-lft-in0.1
Simplified0.1
if 9.59721426538854149e74 < (* (- 1.0 y) z) Initial program 8.8
rmApplied sub-neg8.8
Applied distribute-lft-in8.8
Simplified8.8
Taylor expanded around inf 8.8
Simplified1.9
Final simplification0.4
herbie shell --seed 2020181
(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))))