Average Error: 7.1 → 2.3
Time: 16.1s
Precision: 64
\[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\]
\[\frac{\mathsf{fma}\left(\frac{1}{\frac{\mathsf{fma}\left(z, t, -x\right)}{z}}, y, x\right) - \frac{\sqrt[3]{x}}{\sqrt[3]{\mathsf{fma}\left(z, t, -x\right)}} \cdot \frac{\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{\mathsf{fma}\left(z, t, -x\right)}}}{\sqrt[3]{\mathsf{fma}\left(z, t, -x\right)}}}{1 + x}\]
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\frac{\mathsf{fma}\left(\frac{1}{\frac{\mathsf{fma}\left(z, t, -x\right)}{z}}, y, x\right) - \frac{\sqrt[3]{x}}{\sqrt[3]{\mathsf{fma}\left(z, t, -x\right)}} \cdot \frac{\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{\mathsf{fma}\left(z, t, -x\right)}}}{\sqrt[3]{\mathsf{fma}\left(z, t, -x\right)}}}{1 + x}
double f(double x, double y, double z, double t) {
        double r585530 = x;
        double r585531 = y;
        double r585532 = z;
        double r585533 = r585531 * r585532;
        double r585534 = r585533 - r585530;
        double r585535 = t;
        double r585536 = r585535 * r585532;
        double r585537 = r585536 - r585530;
        double r585538 = r585534 / r585537;
        double r585539 = r585530 + r585538;
        double r585540 = 1.0;
        double r585541 = r585530 + r585540;
        double r585542 = r585539 / r585541;
        return r585542;
}

double f(double x, double y, double z, double t) {
        double r585543 = 1.0;
        double r585544 = z;
        double r585545 = t;
        double r585546 = x;
        double r585547 = -r585546;
        double r585548 = fma(r585544, r585545, r585547);
        double r585549 = r585548 / r585544;
        double r585550 = r585543 / r585549;
        double r585551 = y;
        double r585552 = fma(r585550, r585551, r585546);
        double r585553 = cbrt(r585546);
        double r585554 = cbrt(r585548);
        double r585555 = r585553 / r585554;
        double r585556 = r585553 * r585553;
        double r585557 = r585556 / r585554;
        double r585558 = r585557 / r585554;
        double r585559 = r585555 * r585558;
        double r585560 = r585552 - r585559;
        double r585561 = 1.0;
        double r585562 = r585561 + r585546;
        double r585563 = r585560 / r585562;
        return r585563;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original7.1
Target0.4
Herbie2.3
\[\frac{x + \left(\frac{y}{t - \frac{x}{z}} - \frac{x}{t \cdot z - x}\right)}{x + 1}\]

Derivation

  1. Initial program 7.1

    \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\]
  2. Simplified7.1

    \[\leadsto \color{blue}{\frac{x + \frac{z \cdot y - x}{z \cdot t - x}}{1 + x}}\]
  3. Using strategy rm
  4. Applied div-sub7.1

    \[\leadsto \frac{x + \color{blue}{\left(\frac{z \cdot y}{z \cdot t - x} - \frac{x}{z \cdot t - x}\right)}}{1 + x}\]
  5. Applied associate-+r-7.1

    \[\leadsto \frac{\color{blue}{\left(x + \frac{z \cdot y}{z \cdot t - x}\right) - \frac{x}{z \cdot t - x}}}{1 + x}\]
  6. Simplified2.2

    \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\frac{z}{\mathsf{fma}\left(t, z, -x\right)}, y, x\right)} - \frac{x}{z \cdot t - x}}{1 + x}\]
  7. Using strategy rm
  8. Applied clear-num2.2

    \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\frac{1}{\frac{\mathsf{fma}\left(t, z, -x\right)}{z}}}, y, x\right) - \frac{x}{z \cdot t - x}}{1 + x}\]
  9. Simplified2.2

    \[\leadsto \frac{\mathsf{fma}\left(\frac{1}{\color{blue}{\frac{\mathsf{fma}\left(z, t, -x\right)}{z}}}, y, x\right) - \frac{x}{z \cdot t - x}}{1 + x}\]
  10. Using strategy rm
  11. Applied add-cube-cbrt2.4

    \[\leadsto \frac{\mathsf{fma}\left(\frac{1}{\frac{\mathsf{fma}\left(z, t, -x\right)}{z}}, y, x\right) - \frac{x}{\color{blue}{\left(\sqrt[3]{z \cdot t - x} \cdot \sqrt[3]{z \cdot t - x}\right) \cdot \sqrt[3]{z \cdot t - x}}}}{1 + x}\]
  12. Applied add-cube-cbrt2.3

    \[\leadsto \frac{\mathsf{fma}\left(\frac{1}{\frac{\mathsf{fma}\left(z, t, -x\right)}{z}}, y, x\right) - \frac{\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}}}{\left(\sqrt[3]{z \cdot t - x} \cdot \sqrt[3]{z \cdot t - x}\right) \cdot \sqrt[3]{z \cdot t - x}}}{1 + x}\]
  13. Applied times-frac2.3

    \[\leadsto \frac{\mathsf{fma}\left(\frac{1}{\frac{\mathsf{fma}\left(z, t, -x\right)}{z}}, y, x\right) - \color{blue}{\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{z \cdot t - x} \cdot \sqrt[3]{z \cdot t - x}} \cdot \frac{\sqrt[3]{x}}{\sqrt[3]{z \cdot t - x}}}}{1 + x}\]
  14. Simplified2.3

    \[\leadsto \frac{\mathsf{fma}\left(\frac{1}{\frac{\mathsf{fma}\left(z, t, -x\right)}{z}}, y, x\right) - \color{blue}{\frac{\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{\mathsf{fma}\left(z, t, -x\right)}}}{\sqrt[3]{\mathsf{fma}\left(z, t, -x\right)}}} \cdot \frac{\sqrt[3]{x}}{\sqrt[3]{z \cdot t - x}}}{1 + x}\]
  15. Simplified2.3

    \[\leadsto \frac{\mathsf{fma}\left(\frac{1}{\frac{\mathsf{fma}\left(z, t, -x\right)}{z}}, y, x\right) - \frac{\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{\mathsf{fma}\left(z, t, -x\right)}}}{\sqrt[3]{\mathsf{fma}\left(z, t, -x\right)}} \cdot \color{blue}{\frac{\sqrt[3]{x}}{\sqrt[3]{\mathsf{fma}\left(z, t, -x\right)}}}}{1 + x}\]
  16. Final simplification2.3

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

Reproduce

herbie shell --seed 2019194 +o rules:numerics
(FPCore (x y z t)
  :name "Diagrams.Trail:splitAtParam  from diagrams-lib-1.3.0.3, A"

  :herbie-target
  (/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0))

  (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))