2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}\begin{array}{l}
\mathbf{if}\;\left(x \cdot y + x \cdot z\right) + y \cdot z \le 1.45551293622058124 \cdot 10^{302}:\\
\;\;\;\;2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{hypot}\left(\sqrt[3]{x} \cdot \left(\sqrt{\sqrt[3]{x}} \cdot \sqrt{y + z}\right), \sqrt{y} \cdot \sqrt{z}\right)\\
\end{array}double code(double x, double y, double z) {
return (2.0 * sqrt((((x * y) + (x * z)) + (y * z))));
}
double code(double x, double y, double z) {
double temp;
if (((((x * y) + (x * z)) + (y * z)) <= 1.4555129362205812e+302)) {
temp = (2.0 * sqrt((((x * y) + (x * z)) + (y * z))));
} else {
temp = (2.0 * hypot((cbrt(x) * (sqrt(cbrt(x)) * sqrt((y + z)))), (sqrt(y) * sqrt(z))));
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 19.3 |
|---|---|
| Target | 18.6 |
| Herbie | 15.7 |
if (+ (+ (* x y) (* x z)) (* y z)) < 1.4555129362205812e+302Initial program 2.5
if 1.4555129362205812e+302 < (+ (+ (* x y) (* x z)) (* y z)) Initial program 61.5
rmApplied add-cube-cbrt61.5
Applied associate-*l*61.5
Applied add-cube-cbrt61.5
Applied associate-*l*61.5
Applied distribute-lft-out61.5
Simplified61.5
rmApplied add-sqr-sqrt62.7
Applied add-sqr-sqrt63.2
Applied unswap-sqr63.2
Applied add-sqr-sqrt63.2
Applied add-sqr-sqrt63.4
Applied unswap-sqr63.4
Applied unswap-sqr63.4
Applied hypot-def48.8
Final simplification15.7
herbie shell --seed 2020066 +o rules:numerics
(FPCore (x y z)
:name "Diagrams.TwoD.Apollonian:descartes from diagrams-contrib-1.3.0.5"
:precision binary64
:herbie-target
(if (< z 7.636950090573675e+176) (* 2 (sqrt (+ (* (+ x y) z) (* x y)))) (* (* (+ (* 0.25 (* (* (pow y -0.75) (* (pow z -0.75) x)) (+ y z))) (* (pow z 0.25) (pow y 0.25))) (+ (* 0.25 (* (* (pow y -0.75) (* (pow z -0.75) x)) (+ y z))) (* (pow z 0.25) (pow y 0.25)))) 2))
(* 2 (sqrt (+ (+ (* x y) (* x z)) (* y z)))))