Average Error: 0.0 → 0.0
Time: 13.6s
Precision: 64
\[500 \cdot \left(x - y\right)\]
\[\mathsf{fma}\left(500, x, -y \cdot 500\right)\]
500 \cdot \left(x - y\right)
\mathsf{fma}\left(500, x, -y \cdot 500\right)
double f(double x, double y) {
        double r126526 = 500.0;
        double r126527 = x;
        double r126528 = y;
        double r126529 = r126527 - r126528;
        double r126530 = r126526 * r126529;
        return r126530;
}

double f(double x, double y) {
        double r126531 = 500.0;
        double r126532 = x;
        double r126533 = y;
        double r126534 = r126533 * r126531;
        double r126535 = -r126534;
        double r126536 = fma(r126531, r126532, r126535);
        return r126536;
}

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 add-sqr-sqrt0.8

    \[\leadsto \color{blue}{\left(\sqrt{500} \cdot \sqrt{500}\right)} \cdot \left(x - y\right)\]
  4. Applied associate-*l*0.6

    \[\leadsto \color{blue}{\sqrt{500} \cdot \left(\sqrt{500} \cdot \left(x - y\right)\right)}\]
  5. Using strategy rm
  6. Applied sub-neg0.6

    \[\leadsto \sqrt{500} \cdot \left(\sqrt{500} \cdot \color{blue}{\left(x + \left(-y\right)\right)}\right)\]
  7. Applied distribute-lft-in0.6

    \[\leadsto \sqrt{500} \cdot \color{blue}{\left(\sqrt{500} \cdot x + \sqrt{500} \cdot \left(-y\right)\right)}\]
  8. Applied distribute-lft-in0.6

    \[\leadsto \color{blue}{\sqrt{500} \cdot \left(\sqrt{500} \cdot x\right) + \sqrt{500} \cdot \left(\sqrt{500} \cdot \left(-y\right)\right)}\]
  9. Simplified0.3

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

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

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

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

Reproduce

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