x \cdot \left(1.0 - \left(1.0 - y\right) \cdot z\right)
\begin{array}{l}
\mathbf{if}\;z \le -2.035243254459298 \cdot 10^{-28}:\\
\;\;\;\;z \cdot \left(x \cdot y - x \cdot 1.0\right) + x \cdot 1.0\\
\mathbf{elif}\;z \le 5.312519142170575 \cdot 10^{+53}:\\
\;\;\;\;\mathsf{fma}\left(\left(y - 1.0\right) \cdot z, x, x \cdot 1.0\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(x \cdot y - x \cdot 1.0\right) + x \cdot 1.0\\
\end{array}double f(double x, double y, double z) {
double r42055170 = x;
double r42055171 = 1.0;
double r42055172 = y;
double r42055173 = r42055171 - r42055172;
double r42055174 = z;
double r42055175 = r42055173 * r42055174;
double r42055176 = r42055171 - r42055175;
double r42055177 = r42055170 * r42055176;
return r42055177;
}
double f(double x, double y, double z) {
double r42055178 = z;
double r42055179 = -2.035243254459298e-28;
bool r42055180 = r42055178 <= r42055179;
double r42055181 = x;
double r42055182 = y;
double r42055183 = r42055181 * r42055182;
double r42055184 = 1.0;
double r42055185 = r42055181 * r42055184;
double r42055186 = r42055183 - r42055185;
double r42055187 = r42055178 * r42055186;
double r42055188 = r42055187 + r42055185;
double r42055189 = 5.312519142170575e+53;
bool r42055190 = r42055178 <= r42055189;
double r42055191 = r42055182 - r42055184;
double r42055192 = r42055191 * r42055178;
double r42055193 = fma(r42055192, r42055181, r42055185);
double r42055194 = r42055190 ? r42055193 : r42055188;
double r42055195 = r42055180 ? r42055188 : r42055194;
return r42055195;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 3.1 |
|---|---|
| Target | 0.2 |
| Herbie | 0.2 |
if z < -2.035243254459298e-28 or 5.312519142170575e+53 < z Initial program 8.0
Simplified8.0
rmApplied fma-udef8.0
Applied distribute-rgt-in8.0
rmApplied associate-*l*0.2
Taylor expanded around 0 0.2
if -2.035243254459298e-28 < z < 5.312519142170575e+53Initial program 0.2
Simplified0.2
rmApplied fma-udef0.2
Applied distribute-rgt-in0.2
rmApplied fma-def0.2
Final simplification0.2
herbie shell --seed 2019163 +o rules:numerics
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSV:hsv from colour-2.3.3, J"
: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))))