2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}
\begin{array}{l}
\mathbf{if}\;y \leq -2.3027336494487103 \cdot 10^{+59}:\\
\;\;\;\;2 \cdot e^{0.25 \cdot \left(\log \left({\left(y + z\right)}^{2}\right) - 2 \cdot \log \left(\frac{-1}{x}\right)\right)}\\
\mathbf{elif}\;y \leq 1.5331640059391025 \cdot 10^{+53}:\\
\;\;\;\;2 \cdot \sqrt{\mathsf{fma}\left(y, x, z \cdot \left(y + x\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot {\left(e^{0.25}\right)}^{\left(2 \cdot \left(\log \left(y + x\right) + \log 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
(if (<= y -2.3027336494487103e+59)
(* 2.0 (exp (* 0.25 (- (log (pow (+ y z) 2.0)) (* 2.0 (log (/ -1.0 x)))))))
(if (<= y 1.5331640059391025e+53)
(* 2.0 (sqrt (fma y x (* z (+ y x)))))
(* 2.0 (pow (exp 0.25) (* 2.0 (+ (log (+ y x)) (log 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 tmp;
if (y <= -2.3027336494487103e+59) {
tmp = 2.0 * exp(0.25 * (log(pow((y + z), 2.0)) - (2.0 * log(-1.0 / x))));
} else if (y <= 1.5331640059391025e+53) {
tmp = 2.0 * sqrt(fma(y, x, (z * (y + x))));
} else {
tmp = 2.0 * pow(exp(0.25), (2.0 * (log(y + x) + log(z))));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 20.1 |
|---|---|
| Target | 11.8 |
| Herbie | 10.4 |
if y < -2.30273364944871029e59Initial program 48.0
Simplified48.0
Applied add-sqr-sqrt_binary6448.1
Applied add-cube-cbrt_binary6448.1
Simplified48.1
Simplified48.1
Taylor expanded in x around -inf 32.2
if -2.30273364944871029e59 < y < 1.5331640059391025e53Initial program 4.3
Simplified4.3
Taylor expanded in x around 0 4.3
Simplified4.3
if 1.5331640059391025e53 < y Initial program 46.2
Simplified46.2
Applied add-sqr-sqrt_binary6446.3
Applied add-cube-cbrt_binary6446.3
Simplified46.3
Simplified46.3
Applied sqrt-unprod_binary6446.3
Simplified46.2
Taylor expanded in z around inf 31.4
Simplified9.5
Final simplification10.4
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)))))