Average Error: 0.0 → 0.0
Time: 10.1s
Precision: 64
\[\left(x + 1.0\right) \cdot y - x\]
\[\mathsf{fma}\left(x, y, y\right) \cdot 1.0 - x\]
\left(x + 1.0\right) \cdot y - x
\mathsf{fma}\left(x, y, y\right) \cdot 1.0 - x
double f(double x, double y) {
        double r10971972 = x;
        double r10971973 = 1.0;
        double r10971974 = r10971972 + r10971973;
        double r10971975 = y;
        double r10971976 = r10971974 * r10971975;
        double r10971977 = r10971976 - r10971972;
        return r10971977;
}

double f(double x, double y) {
        double r10971978 = x;
        double r10971979 = y;
        double r10971980 = fma(r10971978, r10971979, r10971979);
        double r10971981 = 1.0;
        double r10971982 = r10971980 * r10971981;
        double r10971983 = r10971982 - r10971978;
        return r10971983;
}

Error

Bits error versus x

Bits error versus y

Derivation

  1. Initial program 0.0

    \[\left(x + 1.0\right) \cdot y - x\]
  2. Using strategy rm
  3. Applied flip3-+16.1

    \[\leadsto \color{blue}{\frac{{x}^{3} + {1.0}^{3}}{x \cdot x + \left(1.0 \cdot 1.0 - x \cdot 1.0\right)}} \cdot y - x\]
  4. Applied associate-*l/17.9

    \[\leadsto \color{blue}{\frac{\left({x}^{3} + {1.0}^{3}\right) \cdot y}{x \cdot x + \left(1.0 \cdot 1.0 - x \cdot 1.0\right)}} - x\]
  5. Simplified17.9

    \[\leadsto \frac{\color{blue}{y \cdot \mathsf{fma}\left(x \cdot x, x, 1.0 \cdot \left(1.0 \cdot 1.0\right)\right)}}{x \cdot x + \left(1.0 \cdot 1.0 - x \cdot 1.0\right)} - x\]
  6. Taylor expanded around 0 0.0

    \[\leadsto \color{blue}{\left(1.0 \cdot y + 1.0 \cdot \left(x \cdot y\right)\right)} - x\]
  7. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, y\right) \cdot 1.0} - x\]
  8. Final simplification0.0

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

Reproduce

herbie shell --seed 2019162 +o rules:numerics
(FPCore (x y)
  :name "Data.Colour.SRGB:transferFunction from colour-2.3.3"
  (- (* (+ x 1.0) y) x))