Average Error: 0.0 → 0.0
Time: 4.8s
Precision: 64
\[500 \cdot \left(x - y\right)\]
\[\mathsf{fma}\left(500, x, \left(-y\right) \cdot 500\right)\]
500 \cdot \left(x - y\right)
\mathsf{fma}\left(500, x, \left(-y\right) \cdot 500\right)
double f(double x, double y) {
        double r12967368 = 500.0;
        double r12967369 = x;
        double r12967370 = y;
        double r12967371 = r12967369 - r12967370;
        double r12967372 = r12967368 * r12967371;
        return r12967372;
}

double f(double x, double y) {
        double r12967373 = 500.0;
        double r12967374 = x;
        double r12967375 = y;
        double r12967376 = -r12967375;
        double r12967377 = r12967376 * r12967373;
        double r12967378 = fma(r12967373, r12967374, r12967377);
        return r12967378;
}

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-lft-in0.0

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

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

    \[\leadsto \mathsf{fma}\left(500, x, \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)))