Average Error: 0.0 → 0.0
Time: 5.8s
Precision: 64
\[500 \cdot \left(x - y\right)\]
\[\mathsf{fma}\left(x, 500, \left(-y\right) \cdot 500\right)\]
500 \cdot \left(x - y\right)
\mathsf{fma}\left(x, 500, \left(-y\right) \cdot 500\right)
double f(double x, double y) {
        double r16882783 = 500.0;
        double r16882784 = x;
        double r16882785 = y;
        double r16882786 = r16882784 - r16882785;
        double r16882787 = r16882783 * r16882786;
        return r16882787;
}

double f(double x, double y) {
        double r16882788 = x;
        double r16882789 = 500.0;
        double r16882790 = y;
        double r16882791 = -r16882790;
        double r16882792 = r16882791 * r16882789;
        double r16882793 = fma(r16882788, r16882789, r16882792);
        return r16882793;
}

Error

Bits error versus x

Bits error versus y

Derivation

  1. Initial program 0.0

    \[500 \cdot \left(x - y\right)\]
  2. Using strategy rm
  3. Applied sub-neg0.0

    \[\leadsto 500 \cdot \color{blue}{\left(x + \left(-y\right)\right)}\]
  4. Applied distribute-rgt-in0.0

    \[\leadsto \color{blue}{x \cdot 500 + \left(-y\right) \cdot 500}\]
  5. Using strategy rm
  6. Applied fma-def0.0

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

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

Reproduce

herbie shell --seed 2019174 +o rules:numerics
(FPCore (x y)
  :name "Data.Colour.CIE:cieLABView from colour-2.3.3, B"
  (* 500.0 (- x y)))