Average Error: 0.0 → 0
Time: 1.8s
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 r185151 = x;
        double r185152 = y;
        double r185153 = r185151 * r185152;
        double r185154 = r185153 - r185151;
        return r185154;
}

double f(double x, double y) {
        double r185155 = x;
        double r185156 = y;
        double r185157 = -r185155;
        double r185158 = fma(r185155, r185156, r185157);
        return r185158;
}

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 2020046 +o rules:numerics
(FPCore (x y)
  :name "Data.Histogram.Bin.LogBinD:$cbinSizeN from histogram-fill-0.8.4.1"
  :precision binary64
  (- (* x y) x))