Average Error: 0.0 → 0.0
Time: 9.3s
Precision: 64
\[\left(\frac{1}{8} \cdot x - \frac{y \cdot z}{2}\right) + t\]
\[\mathsf{fma}\left(-\frac{y}{2}, z, \mathsf{fma}\left(\frac{x}{8}, 1, t\right)\right)\]
\left(\frac{1}{8} \cdot x - \frac{y \cdot z}{2}\right) + t
\mathsf{fma}\left(-\frac{y}{2}, z, \mathsf{fma}\left(\frac{x}{8}, 1, t\right)\right)
double f(double x, double y, double z, double t) {
        double r664956 = 1.0;
        double r664957 = 8.0;
        double r664958 = r664956 / r664957;
        double r664959 = x;
        double r664960 = r664958 * r664959;
        double r664961 = y;
        double r664962 = z;
        double r664963 = r664961 * r664962;
        double r664964 = 2.0;
        double r664965 = r664963 / r664964;
        double r664966 = r664960 - r664965;
        double r664967 = t;
        double r664968 = r664966 + r664967;
        return r664968;
}

double f(double x, double y, double z, double t) {
        double r664969 = y;
        double r664970 = 2.0;
        double r664971 = r664969 / r664970;
        double r664972 = -r664971;
        double r664973 = z;
        double r664974 = x;
        double r664975 = 8.0;
        double r664976 = r664974 / r664975;
        double r664977 = 1.0;
        double r664978 = t;
        double r664979 = fma(r664976, r664977, r664978);
        double r664980 = fma(r664972, r664973, r664979);
        return r664980;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original0.0
Target0.0
Herbie0.0
\[\left(\frac{x}{8} + t\right) - \frac{z}{2} \cdot y\]

Derivation

  1. Initial program 0.0

    \[\left(\frac{1}{8} \cdot x - \frac{y \cdot z}{2}\right) + t\]
  2. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x}{8}, 1, t\right) - \frac{y \cdot z}{2}}\]
  3. Using strategy rm
  4. Applied add-cube-cbrt0.4

    \[\leadsto \mathsf{fma}\left(\frac{x}{8}, 1, t\right) - \color{blue}{\left(\sqrt[3]{\frac{y \cdot z}{2}} \cdot \sqrt[3]{\frac{y \cdot z}{2}}\right) \cdot \sqrt[3]{\frac{y \cdot z}{2}}}\]
  5. Applied add-sqr-sqrt32.8

    \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(\frac{x}{8}, 1, t\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{x}{8}, 1, t\right)}} - \left(\sqrt[3]{\frac{y \cdot z}{2}} \cdot \sqrt[3]{\frac{y \cdot z}{2}}\right) \cdot \sqrt[3]{\frac{y \cdot z}{2}}\]
  6. Applied prod-diff32.8

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

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

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

    \[\leadsto \mathsf{fma}\left(-\frac{y}{2}, z, \mathsf{fma}\left(\frac{x}{8}, 1, t\right)\right)\]

Reproduce

herbie shell --seed 2019196 +o rules:numerics
(FPCore (x y z t)
  :name "Diagrams.Solve.Polynomial:quartForm  from diagrams-solve-0.1, B"

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

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