x \cdot \left(1 - \left(1 - y\right) \cdot z\right)
\begin{array}{l}
\mathbf{if}\;x \le -2.604483202204387970419560978992306305207 \cdot 10^{48}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot \left(y - 1\right), x, 1 \cdot x\right)\\
\mathbf{elif}\;x \le 3.089359645532634351223373452505685181748 \cdot 10^{-150}:\\
\;\;\;\;\left(x \cdot \left(y - 1\right)\right) \cdot z + 1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot \left(y - 1\right), x, 1 \cdot x\right)\\
\end{array}double f(double x, double y, double z) {
double r34731321 = x;
double r34731322 = 1.0;
double r34731323 = y;
double r34731324 = r34731322 - r34731323;
double r34731325 = z;
double r34731326 = r34731324 * r34731325;
double r34731327 = r34731322 - r34731326;
double r34731328 = r34731321 * r34731327;
return r34731328;
}
double f(double x, double y, double z) {
double r34731329 = x;
double r34731330 = -2.604483202204388e+48;
bool r34731331 = r34731329 <= r34731330;
double r34731332 = z;
double r34731333 = y;
double r34731334 = 1.0;
double r34731335 = r34731333 - r34731334;
double r34731336 = r34731332 * r34731335;
double r34731337 = r34731334 * r34731329;
double r34731338 = fma(r34731336, r34731329, r34731337);
double r34731339 = 3.0893596455326344e-150;
bool r34731340 = r34731329 <= r34731339;
double r34731341 = r34731329 * r34731335;
double r34731342 = r34731341 * r34731332;
double r34731343 = r34731342 + r34731337;
double r34731344 = r34731340 ? r34731343 : r34731338;
double r34731345 = r34731331 ? r34731338 : r34731344;
return r34731345;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 3.3 |
|---|---|
| Target | 0.3 |
| Herbie | 0.6 |
if x < -2.604483202204388e+48 or 3.0893596455326344e-150 < x Initial program 1.0
Simplified1.0
rmApplied fma-udef1.0
Applied distribute-rgt-in1.0
rmApplied fma-def1.0
if -2.604483202204388e+48 < x < 3.0893596455326344e-150Initial program 5.5
Simplified5.5
rmApplied fma-udef5.5
Applied distribute-rgt-in5.5
rmApplied associate-*l*0.3
Final simplification0.6
herbie shell --seed 2019174 +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))))