Average Error: 0.0 → 0
Time: 2.0s
Precision: 64
\[x \cdot y - x\]
\[\mathsf{fma}\left(x, y, -x\right)\]
x \cdot y - x
\mathsf{fma}\left(x, y, -x\right)
double f(double x, double y) {
        double r275072 = x;
        double r275073 = y;
        double r275074 = r275072 * r275073;
        double r275075 = r275074 - r275072;
        return r275075;
}

double f(double x, double y) {
        double r275076 = x;
        double r275077 = y;
        double r275078 = -r275076;
        double r275079 = fma(r275076, r275077, r275078);
        return r275079;
}

Error

Bits error versus x

Bits error versus y

Derivation

  1. Initial program 0.0

    \[x \cdot y - x\]
  2. Using strategy rm
  3. Applied add-cube-cbrt0.8

    \[\leadsto x \cdot y - \color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}}\]
  4. Applied prod-diff0.8

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, -\sqrt[3]{x} \cdot \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right)\right) + \mathsf{fma}\left(-\sqrt[3]{x}, \sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x} \cdot \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right)\right)}\]
  5. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, -x\right)} + \mathsf{fma}\left(-\sqrt[3]{x}, \sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x} \cdot \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right)\right)\]
  6. Simplified0

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

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

Reproduce

herbie shell --seed 2020047 +o rules:numerics
(FPCore (x y)
  :name "Data.Histogram.Bin.LogBinD:$cbinSizeN from histogram-fill-0.8.4.1"
  :precision binary64
  (- (* x y) x))