Average Error: 0.1 → 0.1
Time: 15.1s
Precision: 64
\[x \cdot \left(1 - x \cdot y\right)\]
\[\mathsf{fma}\left(x, -y, 1\right) \cdot x\]
x \cdot \left(1 - x \cdot y\right)
\mathsf{fma}\left(x, -y, 1\right) \cdot x
double f(double x, double y) {
        double r86064 = x;
        double r86065 = 1.0;
        double r86066 = y;
        double r86067 = r86064 * r86066;
        double r86068 = r86065 - r86067;
        double r86069 = r86064 * r86068;
        return r86069;
}

double f(double x, double y) {
        double r86070 = x;
        double r86071 = y;
        double r86072 = -r86071;
        double r86073 = 1.0;
        double r86074 = fma(r86070, r86072, r86073);
        double r86075 = r86074 * r86070;
        return r86075;
}

Error

Bits error versus x

Bits error versus y

Derivation

  1. Initial program 0.1

    \[x \cdot \left(1 - x \cdot y\right)\]
  2. Simplified0.1

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

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

Reproduce

herbie shell --seed 2019179 +o rules:numerics
(FPCore (x y)
  :name "Numeric.SpecFunctions:log1p from math-functions-0.1.5.2, A"
  (* x (- 1.0 (* x y))))