Average Error: 0.1 → 0.1
Time: 20.9s
Precision: 64
\[\left(x \cdot y + z\right) \cdot y + t\]
\[\mathsf{fma}\left(y, y \cdot x, z \cdot y\right) + t\]
\left(x \cdot y + z\right) \cdot y + t
\mathsf{fma}\left(y, y \cdot x, z \cdot y\right) + t
double f(double x, double y, double z, double t) {
        double r7648592 = x;
        double r7648593 = y;
        double r7648594 = r7648592 * r7648593;
        double r7648595 = z;
        double r7648596 = r7648594 + r7648595;
        double r7648597 = r7648596 * r7648593;
        double r7648598 = t;
        double r7648599 = r7648597 + r7648598;
        return r7648599;
}

double f(double x, double y, double z, double t) {
        double r7648600 = y;
        double r7648601 = x;
        double r7648602 = r7648600 * r7648601;
        double r7648603 = z;
        double r7648604 = r7648603 * r7648600;
        double r7648605 = fma(r7648600, r7648602, r7648604);
        double r7648606 = t;
        double r7648607 = r7648605 + r7648606;
        return r7648607;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Derivation

  1. Initial program 0.1

    \[\left(x \cdot y + z\right) \cdot y + t\]
  2. Using strategy rm
  3. Applied add-sqr-sqrt28.5

    \[\leadsto \color{blue}{\sqrt{\left(x \cdot y + z\right) \cdot y} \cdot \sqrt{\left(x \cdot y + z\right) \cdot y}} + t\]
  4. Taylor expanded around 0 4.4

    \[\leadsto \color{blue}{\left(x \cdot {y}^{2} + z \cdot y\right)} + t\]
  5. Simplified0.1

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, x \cdot y, z \cdot y\right)} + t\]
  6. Final simplification0.1

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

Reproduce

herbie shell --seed 2019169 +o rules:numerics
(FPCore (x y z t)
  :name "Language.Haskell.HsColour.ColourHighlight:unbase from hscolour-1.23"
  (+ (* (+ (* x y) z) y) t))