x \cdot \left(1 - \left(1 - y\right) \cdot z\right)
\begin{array}{l}
\mathbf{if}\;\left(1 - y\right) \cdot z \leq -6.7056208390435025 \cdot 10^{+137}:\\
\;\;\;\;x + \left(y \cdot \left(z \cdot x\right) - z \cdot x\right)\\
\mathbf{elif}\;\left(1 - y\right) \cdot z \leq 1.8141537630332114 \cdot 10^{+113}:\\
\;\;\;\;x + x \cdot \left(z \cdot \left(y + -1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y \cdot x - x\right)\\
\end{array}(FPCore (x y z) :precision binary64 (* x (- 1.0 (* (- 1.0 y) z))))
(FPCore (x y z)
:precision binary64
(if (<= (* (- 1.0 y) z) -6.7056208390435025e+137)
(+ x (- (* y (* z x)) (* z x)))
(if (<= (* (- 1.0 y) z) 1.8141537630332114e+113)
(+ x (* x (* z (+ y -1.0))))
(+ x (* z (- (* y x) x))))))double code(double x, double y, double z) {
return x * (1.0 - ((1.0 - y) * z));
}
double code(double x, double y, double z) {
double tmp;
if (((1.0 - y) * z) <= -6.7056208390435025e+137) {
tmp = x + ((y * (z * x)) - (z * x));
} else if (((1.0 - y) * z) <= 1.8141537630332114e+113) {
tmp = x + (x * (z * (y + -1.0)));
} else {
tmp = x + (z * ((y * x) - x));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 3.5 |
|---|---|
| Target | 0.2 |
| Herbie | 0.4 |
if (*.f64 (-.f64 1 y) z) < -6.7056208390435025e137Initial program 12.3
rmApplied sub-neg_binary64_2325912.3
Applied distribute-rgt-in_binary64_2321612.3
Simplified12.3
Simplified12.3
rmApplied sub-neg_binary64_2325912.3
Applied distribute-rgt-in_binary64_2321612.3
Simplified12.3
Simplified12.3
rmApplied associate-*r*_binary64_232061.0
rmApplied unsub-neg_binary64_232601.0
if -6.7056208390435025e137 < (*.f64 (-.f64 1 y) z) < 1.81415376303321137e113Initial program 0.1
rmApplied sub-neg_binary64_232590.1
Applied distribute-rgt-in_binary64_232160.1
if 1.81415376303321137e113 < (*.f64 (-.f64 1 y) z) Initial program 11.4
rmApplied sub-neg_binary64_2325911.4
Applied distribute-rgt-in_binary64_2321611.4
Simplified11.4
Simplified11.4
Taylor expanded around 0 1.8
Final simplification0.4
herbie shell --seed 2021028
(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) (* (- 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))))