Average Error: 0.1 → 0.0
Time: 1.7m
Precision: 64
\[\left(\left(x \cdot y + \frac{z \cdot t}{16.0}\right) - \frac{a \cdot b}{4.0}\right) + c\]
\[\mathsf{fma}\left(x, y, \mathsf{fma}\left(\frac{z}{16.0}, t, \mathsf{fma}\left(-a, \frac{b}{4.0}, c\right)\right)\right)\]
\left(\left(x \cdot y + \frac{z \cdot t}{16.0}\right) - \frac{a \cdot b}{4.0}\right) + c
\mathsf{fma}\left(x, y, \mathsf{fma}\left(\frac{z}{16.0}, t, \mathsf{fma}\left(-a, \frac{b}{4.0}, c\right)\right)\right)
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r10887157 = x;
        double r10887158 = y;
        double r10887159 = r10887157 * r10887158;
        double r10887160 = z;
        double r10887161 = t;
        double r10887162 = r10887160 * r10887161;
        double r10887163 = 16.0;
        double r10887164 = r10887162 / r10887163;
        double r10887165 = r10887159 + r10887164;
        double r10887166 = a;
        double r10887167 = b;
        double r10887168 = r10887166 * r10887167;
        double r10887169 = 4.0;
        double r10887170 = r10887168 / r10887169;
        double r10887171 = r10887165 - r10887170;
        double r10887172 = c;
        double r10887173 = r10887171 + r10887172;
        return r10887173;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r10887174 = x;
        double r10887175 = y;
        double r10887176 = z;
        double r10887177 = 16.0;
        double r10887178 = r10887176 / r10887177;
        double r10887179 = t;
        double r10887180 = a;
        double r10887181 = -r10887180;
        double r10887182 = b;
        double r10887183 = 4.0;
        double r10887184 = r10887182 / r10887183;
        double r10887185 = c;
        double r10887186 = fma(r10887181, r10887184, r10887185);
        double r10887187 = fma(r10887178, r10887179, r10887186);
        double r10887188 = fma(r10887174, r10887175, r10887187);
        return r10887188;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 0.1

    \[\left(\left(x \cdot y + \frac{z \cdot t}{16.0}\right) - \frac{a \cdot b}{4.0}\right) + c\]
  2. Using strategy rm
  3. Applied *-un-lft-identity0.1

    \[\leadsto \left(\left(x \cdot y + \frac{z \cdot t}{16.0}\right) - \frac{a \cdot b}{4.0}\right) + \color{blue}{1 \cdot c}\]
  4. Applied *-un-lft-identity0.1

    \[\leadsto \color{blue}{1 \cdot \left(\left(x \cdot y + \frac{z \cdot t}{16.0}\right) - \frac{a \cdot b}{4.0}\right)} + 1 \cdot c\]
  5. Applied distribute-lft-out0.1

    \[\leadsto \color{blue}{1 \cdot \left(\left(\left(x \cdot y + \frac{z \cdot t}{16.0}\right) - \frac{a \cdot b}{4.0}\right) + c\right)}\]
  6. Simplified0.0

    \[\leadsto 1 \cdot \color{blue}{\mathsf{fma}\left(x, y, \mathsf{fma}\left(\frac{z}{16.0}, t, \mathsf{fma}\left(-a, \frac{b}{4.0}, c\right)\right)\right)}\]
  7. Final simplification0.0

    \[\leadsto \mathsf{fma}\left(x, y, \mathsf{fma}\left(\frac{z}{16.0}, t, \mathsf{fma}\left(-a, \frac{b}{4.0}, c\right)\right)\right)\]

Reproduce

herbie shell --seed 2019163 +o rules:numerics
(FPCore (x y z t a b c)
  :name "Diagrams.Solve.Polynomial:quartForm  from diagrams-solve-0.1, C"
  (+ (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) c))