Average Error: 19.9 → 19.9
Time: 4.9s
Precision: 64
\[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}\]
\[2 \cdot \sqrt{x \cdot y + \mathsf{fma}\left(x, z, y \cdot z\right)}\]
2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}
2 \cdot \sqrt{x \cdot y + \mathsf{fma}\left(x, z, y \cdot z\right)}
double f(double x, double y, double z) {
        double r679097 = 2.0;
        double r679098 = x;
        double r679099 = y;
        double r679100 = r679098 * r679099;
        double r679101 = z;
        double r679102 = r679098 * r679101;
        double r679103 = r679100 + r679102;
        double r679104 = r679099 * r679101;
        double r679105 = r679103 + r679104;
        double r679106 = sqrt(r679105);
        double r679107 = r679097 * r679106;
        return r679107;
}

double f(double x, double y, double z) {
        double r679108 = 2.0;
        double r679109 = x;
        double r679110 = y;
        double r679111 = r679109 * r679110;
        double r679112 = z;
        double r679113 = r679110 * r679112;
        double r679114 = fma(r679109, r679112, r679113);
        double r679115 = r679111 + r679114;
        double r679116 = sqrt(r679115);
        double r679117 = r679108 * r679116;
        return r679117;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original19.9
Target19.2
Herbie19.9
\[\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. Initial program 19.9

    \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}\]
  2. Using strategy rm
  3. Applied associate-+l+19.9

    \[\leadsto 2 \cdot \sqrt{\color{blue}{x \cdot y + \left(x \cdot z + y \cdot z\right)}}\]
  4. Simplified19.9

    \[\leadsto 2 \cdot \sqrt{x \cdot y + \color{blue}{\mathsf{fma}\left(x, z, y \cdot z\right)}}\]
  5. Final simplification19.9

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

Reproduce

herbie shell --seed 2020089 +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)))))