Average Error: 0.0 → 0.0
Time: 50.7s
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 r14826089 = 500.0;
        double r14826090 = x;
        double r14826091 = y;
        double r14826092 = r14826090 - r14826091;
        double r14826093 = r14826089 * r14826092;
        return r14826093;
}

double f(double x, double y) {
        double r14826094 = x;
        double r14826095 = 500.0;
        double r14826096 = y;
        double r14826097 = -r14826096;
        double r14826098 = r14826097 * r14826095;
        double r14826099 = fma(r14826094, r14826095, r14826098);
        return r14826099;
}

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 2019200 +o rules:numerics
(FPCore (x y)
  :name "Data.Colour.CIE:cieLABView from colour-2.3.3, B"
  (* 500.0 (- x y)))