x \cdot \sqrt{y \cdot y - z \cdot z}\begin{array}{l}
\mathbf{if}\;y \le -7.9985446061757004 \cdot 10^{-268}:\\
\;\;\;\;-1 \cdot \left(x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}double code(double x, double y, double z) {
return (x * sqrt(((y * y) - (z * z))));
}
double code(double x, double y, double z) {
double temp;
if ((y <= -7.9985446061757e-268)) {
temp = (-1.0 * (x * y));
} else {
temp = (x * y);
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 25.7 |
|---|---|
| Target | 0.5 |
| Herbie | 0.5 |
if y < -7.9985446061757e-268Initial program 25.6
Taylor expanded around -inf 0.5
if -7.9985446061757e-268 < y Initial program 25.8
Taylor expanded around inf 0.6
Final simplification0.5
herbie shell --seed 2020058 +o rules:numerics
(FPCore (x y z)
:name "Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, B"
:precision binary64
:herbie-target
(if (< y 2.5816096488251695e-278) (- (* x y)) (* x (* (sqrt (+ y z)) (sqrt (- y z)))))
(* x (sqrt (- (* y y) (* z z)))))