Average Error: 19.3 → 15.7
Time: 7.0s
Precision: 64
\[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}\]
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;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original19.3
Target18.6
Herbie15.7
\[\begin{array}{l} \mathbf{if}\;z \lt 7.6369500905736745 \cdot 10^{176}:\\ \;\;\;\;2 \cdot \sqrt{\left(x + y\right) \cdot z + x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(0.25 \cdot \left(\left({y}^{-0.75} \cdot \left({z}^{-0.75} \cdot x\right)\right) \cdot \left(y + z\right)\right) + {z}^{0.25} \cdot {y}^{0.25}\right) \cdot \left(0.25 \cdot \left(\left({y}^{-0.75} \cdot \left({z}^{-0.75} \cdot x\right)\right) \cdot \left(y + z\right)\right) + {z}^{0.25} \cdot {y}^{0.25}\right)\right) \cdot 2\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if (+ (+ (* x y) (* x z)) (* y z)) < 1.4555129362205812e+302

    1. Initial program 2.5

      \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}\]

    if 1.4555129362205812e+302 < (+ (+ (* x y) (* x z)) (* y z))

    1. Initial program 61.5

      \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt61.5

      \[\leadsto 2 \cdot \sqrt{\left(x \cdot y + \color{blue}{\left(\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}\right)} \cdot z\right) + y \cdot z}\]
    4. Applied associate-*l*61.5

      \[\leadsto 2 \cdot \sqrt{\left(x \cdot y + \color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot z\right)}\right) + y \cdot z}\]
    5. Applied add-cube-cbrt61.5

      \[\leadsto 2 \cdot \sqrt{\left(\color{blue}{\left(\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}\right)} \cdot y + \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot z\right)\right) + y \cdot z}\]
    6. Applied associate-*l*61.5

      \[\leadsto 2 \cdot \sqrt{\left(\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot y\right)} + \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot z\right)\right) + y \cdot z}\]
    7. Applied distribute-lft-out61.5

      \[\leadsto 2 \cdot \sqrt{\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot y + \sqrt[3]{x} \cdot z\right)} + y \cdot z}\]
    8. Simplified61.5

      \[\leadsto 2 \cdot \sqrt{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \color{blue}{\left(\sqrt[3]{x} \cdot \left(y + z\right)\right)} + y \cdot z}\]
    9. Using strategy rm
    10. Applied add-sqr-sqrt62.7

      \[\leadsto 2 \cdot \sqrt{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \left(y + z\right)\right) + y \cdot \color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right)}}\]
    11. Applied add-sqr-sqrt63.2

      \[\leadsto 2 \cdot \sqrt{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \left(y + z\right)\right) + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \left(\sqrt{z} \cdot \sqrt{z}\right)}\]
    12. Applied unswap-sqr63.2

      \[\leadsto 2 \cdot \sqrt{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \left(y + z\right)\right) + \color{blue}{\left(\sqrt{y} \cdot \sqrt{z}\right) \cdot \left(\sqrt{y} \cdot \sqrt{z}\right)}}\]
    13. Applied add-sqr-sqrt63.2

      \[\leadsto 2 \cdot \sqrt{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \color{blue}{\left(\sqrt{y + z} \cdot \sqrt{y + z}\right)}\right) + \left(\sqrt{y} \cdot \sqrt{z}\right) \cdot \left(\sqrt{y} \cdot \sqrt{z}\right)}\]
    14. Applied add-sqr-sqrt63.4

      \[\leadsto 2 \cdot \sqrt{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\color{blue}{\left(\sqrt{\sqrt[3]{x}} \cdot \sqrt{\sqrt[3]{x}}\right)} \cdot \left(\sqrt{y + z} \cdot \sqrt{y + z}\right)\right) + \left(\sqrt{y} \cdot \sqrt{z}\right) \cdot \left(\sqrt{y} \cdot \sqrt{z}\right)}\]
    15. Applied unswap-sqr63.4

      \[\leadsto 2 \cdot \sqrt{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \color{blue}{\left(\left(\sqrt{\sqrt[3]{x}} \cdot \sqrt{y + z}\right) \cdot \left(\sqrt{\sqrt[3]{x}} \cdot \sqrt{y + z}\right)\right)} + \left(\sqrt{y} \cdot \sqrt{z}\right) \cdot \left(\sqrt{y} \cdot \sqrt{z}\right)}\]
    16. Applied unswap-sqr63.4

      \[\leadsto 2 \cdot \sqrt{\color{blue}{\left(\sqrt[3]{x} \cdot \left(\sqrt{\sqrt[3]{x}} \cdot \sqrt{y + z}\right)\right) \cdot \left(\sqrt[3]{x} \cdot \left(\sqrt{\sqrt[3]{x}} \cdot \sqrt{y + z}\right)\right)} + \left(\sqrt{y} \cdot \sqrt{z}\right) \cdot \left(\sqrt{y} \cdot \sqrt{z}\right)}\]
    17. Applied hypot-def48.8

      \[\leadsto 2 \cdot \color{blue}{\mathsf{hypot}\left(\sqrt[3]{x} \cdot \left(\sqrt{\sqrt[3]{x}} \cdot \sqrt{y + z}\right), \sqrt{y} \cdot \sqrt{z}\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification15.7

    \[\leadsto \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}\]

Reproduce

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)))))