Average Error: 0.2 → 0.2
Time: 26.3s
Precision: 64
\[\mathsf{fma}\left(x, y, z\right) - \frac{\sqrt{x} + \sqrt{y}}{\sqrt{z}}\]
\[\mathsf{fma}\left(x, y, z\right) - \frac{x - y}{\sqrt{z} \cdot \left(\sqrt{x} - \sqrt{y}\right)}\]
\mathsf{fma}\left(x, y, z\right) - \frac{\sqrt{x} + \sqrt{y}}{\sqrt{z}}
\mathsf{fma}\left(x, y, z\right) - \frac{x - y}{\sqrt{z} \cdot \left(\sqrt{x} - \sqrt{y}\right)}
double f(double x, double y, double z) {
        double r1885390 = x;
        double r1885391 = y;
        double r1885392 = z;
        double r1885393 = fma(r1885390, r1885391, r1885392);
        double r1885394 = sqrt(r1885390);
        double r1885395 = sqrt(r1885391);
        double r1885396 = r1885394 + r1885395;
        double r1885397 = sqrt(r1885392);
        double r1885398 = r1885396 / r1885397;
        double r1885399 = r1885393 - r1885398;
        return r1885399;
}

double f(double x, double y, double z) {
        double r1885400 = x;
        double r1885401 = y;
        double r1885402 = z;
        double r1885403 = fma(r1885400, r1885401, r1885402);
        double r1885404 = r1885400 - r1885401;
        double r1885405 = sqrt(r1885402);
        double r1885406 = sqrt(r1885400);
        double r1885407 = sqrt(r1885401);
        double r1885408 = r1885406 - r1885407;
        double r1885409 = r1885405 * r1885408;
        double r1885410 = r1885404 / r1885409;
        double r1885411 = r1885403 - r1885410;
        return r1885411;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Initial program 0.2

    \[\mathsf{fma}\left(x, y, z\right) - \frac{\sqrt{x} + \sqrt{y}}{\sqrt{z}}\]
  2. Using strategy rm
  3. Applied flip-+0.2

    \[\leadsto \mathsf{fma}\left(x, y, z\right) - \frac{\color{blue}{\frac{\sqrt{x} \cdot \sqrt{x} - \sqrt{y} \cdot \sqrt{y}}{\sqrt{x} - \sqrt{y}}}}{\sqrt{z}}\]
  4. Simplified0.2

    \[\leadsto \mathsf{fma}\left(x, y, z\right) - \frac{\frac{\color{blue}{x - y}}{\sqrt{x} - \sqrt{y}}}{\sqrt{z}}\]
  5. Using strategy rm
  6. Applied div-inv0.2

    \[\leadsto \mathsf{fma}\left(x, y, z\right) - \frac{\color{blue}{\left(x - y\right) \cdot \frac{1}{\sqrt{x} - \sqrt{y}}}}{\sqrt{z}}\]
  7. Applied associate-/l*0.2

    \[\leadsto \mathsf{fma}\left(x, y, z\right) - \color{blue}{\frac{x - y}{\frac{\sqrt{z}}{\frac{1}{\sqrt{x} - \sqrt{y}}}}}\]
  8. Simplified0.2

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

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

Reproduce

herbie shell --seed 1 
(FPCore (x y z)
  :name "fma(x, y, z) - (sqrt(x) + sqrt(y)) / sqrt(z)"
  :precision binary64
  (- (fma x y z) (/ (+ (sqrt x) (sqrt y)) (sqrt z))))