2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}
\begin{array}{l}
\mathbf{if}\;y \leq -2.361197447632789 \cdot 10^{+24}:\\
\;\;\;\;2 \cdot {\left(\sqrt{e^{0.3333333333333333 \cdot \left(\log \left(-\left(y + z\right)\right) - \log \left(\frac{-1}{x}\right)\right)}}\right)}^{3}\\
\mathbf{elif}\;y \leq 1.8541994331994472 \cdot 10^{+49}:\\
\;\;\;\;2 \cdot \sqrt{\mathsf{fma}\left(x, y, z \cdot x\right) + y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot {\left(\sqrt{{\left(e^{0.3333333333333333}\right)}^{\left(\log \left(y + x\right) + \log z\right)}}\right)}^{3}\\
\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.361197447632789e+24)
(*
2.0
(pow
(sqrt (exp (* 0.3333333333333333 (- (log (- (+ y z))) (log (/ -1.0 x))))))
3.0))
(if (<= y 1.8541994331994472e+49)
(* 2.0 (sqrt (+ (fma x y (* z x)) (* y z))))
(*
2.0
(pow
(sqrt (pow (exp 0.3333333333333333) (+ (log (+ y x)) (log z))))
3.0)))))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.361197447632789e+24) {
tmp = 2.0 * pow(sqrt(exp(0.3333333333333333 * (log(-(y + z)) - log(-1.0 / x)))), 3.0);
} else if (y <= 1.8541994331994472e+49) {
tmp = 2.0 * sqrt(fma(x, y, (z * x)) + (y * z));
} else {
tmp = 2.0 * pow(sqrt(pow(exp(0.3333333333333333), (log(y + x) + log(z)))), 3.0);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 20.0 |
|---|---|
| Target | 11.5 |
| Herbie | 5.1 |
if y < -2.3611974476327889e24Initial program 40.1
Applied add-cube-cbrt_binary6440.4
Applied sqrt-prod_binary6440.4
Simplified40.4
Simplified40.4
Applied add-sqr-sqrt_binary6440.4
Applied fabs-sqr_binary6440.4
Applied pow3_binary6440.4
Taylor expanded in x around -inf 7.0
Simplified7.0
if -2.3611974476327889e24 < y < 1.85419943319944716e49Initial program 3.9
Applied fma-def_binary643.9
if 1.85419943319944716e49 < y Initial program 45.2
Applied add-cube-cbrt_binary6445.4
Applied sqrt-prod_binary6445.4
Simplified45.4
Simplified45.4
Applied add-sqr-sqrt_binary6445.5
Applied fabs-sqr_binary6445.5
Applied pow3_binary6445.5
Taylor expanded in z around inf 7.1
Simplified6.7
Final simplification5.1
herbie shell --seed 2022019
(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)))))