x \cdot \sqrt{y \cdot y - z \cdot z}\begin{array}{l}
\mathbf{if}\;y \le -4.5717632367100802 \cdot 10^{-266}:\\
\;\;\;\;x \cdot \left(-1 \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 VAR;
if ((y <= -4.57176323671008e-266)) {
VAR = (x * (-1.0 * y));
} else {
VAR = (x * y);
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 24.1 |
|---|---|
| Target | 0.6 |
| Herbie | 0.8 |
if y < -4.57176323671008e-266Initial program 23.9
Taylor expanded around -inf 0.7
if -4.57176323671008e-266 < y Initial program 24.4
Taylor expanded around inf 0.9
Final simplification0.8
herbie shell --seed 2020092 +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)))))