Average Error: 19.5 → 19.5
Time: 13.7s
Precision: 64
\[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}\]
\[2 \cdot \sqrt{\mathsf{fma}\left(y + x, z, x \cdot y\right)}\]
2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}
2 \cdot \sqrt{\mathsf{fma}\left(y + x, z, x \cdot y\right)}
double f(double x, double y, double z) {
        double r29911109 = 2.0;
        double r29911110 = x;
        double r29911111 = y;
        double r29911112 = r29911110 * r29911111;
        double r29911113 = z;
        double r29911114 = r29911110 * r29911113;
        double r29911115 = r29911112 + r29911114;
        double r29911116 = r29911111 * r29911113;
        double r29911117 = r29911115 + r29911116;
        double r29911118 = sqrt(r29911117);
        double r29911119 = r29911109 * r29911118;
        return r29911119;
}

double f(double x, double y, double z) {
        double r29911120 = 2.0;
        double r29911121 = y;
        double r29911122 = x;
        double r29911123 = r29911121 + r29911122;
        double r29911124 = z;
        double r29911125 = r29911122 * r29911121;
        double r29911126 = fma(r29911123, r29911124, r29911125);
        double r29911127 = sqrt(r29911126);
        double r29911128 = r29911120 * r29911127;
        return r29911128;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original19.5
Target18.5
Herbie19.5
\[\begin{array}{l} \mathbf{if}\;z \lt 7.636950090573674520215292914121377944071 \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.5

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

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

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

Reproduce

herbie shell --seed 2019192 +o rules:numerics
(FPCore (x y z)
  :name "Diagrams.TwoD.Apollonian:descartes from diagrams-contrib-1.3.0.5"

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