Average Error: 0.0 → 0.0
Time: 12.0s
Precision: 64
\[500 \cdot \left(x - y\right)\]
\[\mathsf{fma}\left(x, 500, 500 \cdot \left(-y\right)\right)\]
500 \cdot \left(x - y\right)
\mathsf{fma}\left(x, 500, 500 \cdot \left(-y\right)\right)
double f(double x, double y) {
        double r220559 = 500.0;
        double r220560 = x;
        double r220561 = y;
        double r220562 = r220560 - r220561;
        double r220563 = r220559 * r220562;
        return r220563;
}

double f(double x, double y) {
        double r220564 = x;
        double r220565 = 500.0;
        double r220566 = y;
        double r220567 = -r220566;
        double r220568 = r220565 * r220567;
        double r220569 = fma(r220564, r220565, r220568);
        return r220569;
}

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. Simplified0.0

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

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

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

Reproduce

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