2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}
\begin{array}{l}
t_0 := 2 \cdot e^{0.5 \cdot \left(\log \left(-\left(y + z\right)\right) - \log \left(\frac{-1}{x}\right)\right)}\\
\mathbf{if}\;y \leq -1.7253211663182805 \cdot 10^{+23}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -1.1343957496177142 \cdot 10^{-192}:\\
\;\;\;\;2 \cdot {\left(\left(y + z\right) \cdot x\right)}^{0.5}\\
\mathbf{elif}\;y \leq -2.7214926907983235 \cdot 10^{-253}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1.0208539709101426 \cdot 10^{+93}:\\
\;\;\;\;2 \cdot \sqrt{\mathsf{fma}\left(y, x, z \cdot \left(y + x\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot e^{0.5 \cdot \left(\log \left(y + x\right) - \log \left(\frac{1}{z}\right)\right)}\\
\end{array}
(FPCore (x y z) :precision binary64 (* 2.0 (sqrt (+ (+ (* x y) (* x z)) (* y z)))))
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 2.0 (exp (* 0.5 (- (log (- (+ y z))) (log (/ -1.0 x))))))))
(if (<= y -1.7253211663182805e+23)
t_0
(if (<= y -1.1343957496177142e-192)
(* 2.0 (pow (* (+ y z) x) 0.5))
(if (<= y -2.7214926907983235e-253)
t_0
(if (<= y 1.0208539709101426e+93)
(* 2.0 (sqrt (fma y x (* z (+ y x)))))
(* 2.0 (exp (* 0.5 (- (log (+ y x)) (log (/ 1.0 z))))))))))))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 t_0 = 2.0 * exp(0.5 * (log(-(y + z)) - log(-1.0 / x)));
double tmp;
if (y <= -1.7253211663182805e+23) {
tmp = t_0;
} else if (y <= -1.1343957496177142e-192) {
tmp = 2.0 * pow(((y + z) * x), 0.5);
} else if (y <= -2.7214926907983235e-253) {
tmp = t_0;
} else if (y <= 1.0208539709101426e+93) {
tmp = 2.0 * sqrt(fma(y, x, (z * (y + x))));
} else {
tmp = 2.0 * exp(0.5 * (log(y + x) - log(1.0 / z)));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 18.5 |
|---|---|
| Target | 10.8 |
| Herbie | 5.1 |
if y < -1.7253211663182805e23 or -1.1343957496177142e-192 < y < -2.7214926907983235e-253Initial program 34.7
Simplified34.6
Applied pow1/2_binary6434.4
Taylor expanded in x around -inf 6.5
if -1.7253211663182805e23 < y < -1.1343957496177142e-192Initial program 0.8
Simplified0.8
Applied pow1/2_binary640.8
Taylor expanded in x around inf 0.9
Simplified0.9
if -2.7214926907983235e-253 < y < 1.020853970910143e93Initial program 6.1
Simplified6.1
Taylor expanded in x around 0 6.1
Simplified6.1
if 1.020853970910143e93 < y Initial program 51.1
Simplified50.7
Applied pow1/2_binary6450.7
Taylor expanded in z around inf 6.8
Final simplification5.1
herbie shell --seed 2022068
(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.0 (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.0))
(* 2.0 (sqrt (+ (+ (* x y) (* x z)) (* y z)))))