Average Error: 0.0 → 0.0
Time: 14.5s
Precision: 64
\[\left(x + y\right) \cdot \left(x - y\right)\]
\[\mathsf{fma}\left(x, x, y \cdot \left(-y\right)\right)\]
\left(x + y\right) \cdot \left(x - y\right)
\mathsf{fma}\left(x, x, y \cdot \left(-y\right)\right)
double f(double x, double y) {
        double r102225 = x;
        double r102226 = y;
        double r102227 = r102225 + r102226;
        double r102228 = r102225 - r102226;
        double r102229 = r102227 * r102228;
        return r102229;
}

double f(double x, double y) {
        double r102230 = x;
        double r102231 = y;
        double r102232 = -r102231;
        double r102233 = r102231 * r102232;
        double r102234 = fma(r102230, r102230, r102233);
        return r102234;
}

Error

Bits error versus x

Bits error versus y

Derivation

  1. Initial program 0.0

    \[\left(x + y\right) \cdot \left(x - y\right)\]
  2. Taylor expanded around 0 0.0

    \[\leadsto \color{blue}{{x}^{2} - {y}^{2}}\]
  3. Simplified0.0

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

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

Reproduce

herbie shell --seed 2019323 +o rules:numerics
(FPCore (x y)
  :name "Examples.Basics.BasicTests:f1 from sbv-4.4"
  :precision binary64
  (* (+ x y) (- x y)))