x \cdot \left(1 - \left(1 - y\right) \cdot z\right)
\begin{array}{l}
\mathbf{if}\;x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \leq -4.490989771135522 \cdot 10^{+167}:\\
\;\;\;\;x + \left(x \cdot z\right) \cdot \left(y - 1\right)\\
\mathbf{elif}\;x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \leq 2.320352310306588 \cdot 10^{+301}:\\
\;\;\;\;x + x \cdot \left(y \cdot z - z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \sqrt[3]{y - 1} \cdot \left(\left(x \cdot z\right) \cdot \left(\sqrt[3]{y - 1} \cdot \sqrt[3]{y - 1}\right)\right)\\
\end{array}(FPCore (x y z) :precision binary64 (* x (- 1.0 (* (- 1.0 y) z))))
(FPCore (x y z)
:precision binary64
(if (<= (* x (- 1.0 (* (- 1.0 y) z))) -4.490989771135522e+167)
(+ x (* (* x z) (- y 1.0)))
(if (<= (* x (- 1.0 (* (- 1.0 y) z))) 2.320352310306588e+301)
(+ x (* x (- (* y z) z)))
(+
x
(*
(cbrt (- y 1.0))
(* (* x z) (* (cbrt (- y 1.0)) (cbrt (- y 1.0)))))))))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 ((x * (1.0 - ((1.0 - y) * z))) <= -4.490989771135522e+167) {
tmp = x + ((x * z) * (y - 1.0));
} else if ((x * (1.0 - ((1.0 - y) * z))) <= 2.320352310306588e+301) {
tmp = x + (x * ((y * z) - z));
} else {
tmp = x + (cbrt(y - 1.0) * ((x * z) * (cbrt(y - 1.0) * cbrt(y - 1.0))));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 3.1 |
|---|---|
| Target | 0.2 |
| Herbie | 0.1 |
if (*.f64 x (-.f64 1 (*.f64 (-.f64 1 y) z))) < -4.49098977113552204e167Initial program 9.2
rmApplied sub-neg_binary64_184859.2
Applied distribute-rgt-in_binary64_184429.2
Simplified9.2
Simplified9.2
rmApplied *-un-lft-identity_binary64_184929.2
Applied distribute-rgt-out--_binary64_184469.2
Applied associate-*r*_binary64_184320.1
if -4.49098977113552204e167 < (*.f64 x (-.f64 1 (*.f64 (-.f64 1 y) z))) < 2.32035231030658789e301Initial program 0.1
rmApplied sub-neg_binary64_184850.1
Applied distribute-rgt-in_binary64_184420.1
Simplified0.1
Simplified0.1
if 2.32035231030658789e301 < (*.f64 x (-.f64 1 (*.f64 (-.f64 1 y) z))) Initial program 51.5
rmApplied sub-neg_binary64_1848551.5
Applied distribute-rgt-in_binary64_1844251.5
Simplified51.5
Simplified51.5
rmApplied *-un-lft-identity_binary64_1849251.5
Applied distribute-rgt-out--_binary64_1844651.5
Applied associate-*r*_binary64_184320.2
rmApplied add-cube-cbrt_binary64_185271.2
Applied associate-*r*_binary64_184321.2
Final simplification0.1
herbie shell --seed 2020344
(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))))