Average Error: 0.1 → 0.0
Time: 11.3s
Precision: 64
\[x - \frac{3}{8} \cdot y\]
\[\frac{\mathsf{fma}\left(y, \frac{3}{8}, x\right)}{\frac{\mathsf{fma}\left(y, \frac{3}{8}, x\right)}{\mathsf{fma}\left(\frac{3}{8}, -y, x\right)}}\]
x - \frac{3}{8} \cdot y
\frac{\mathsf{fma}\left(y, \frac{3}{8}, x\right)}{\frac{\mathsf{fma}\left(y, \frac{3}{8}, x\right)}{\mathsf{fma}\left(\frac{3}{8}, -y, x\right)}}
double f(double x, double y) {
        double r8817589 = x;
        double r8817590 = 3.0;
        double r8817591 = 8.0;
        double r8817592 = r8817590 / r8817591;
        double r8817593 = y;
        double r8817594 = r8817592 * r8817593;
        double r8817595 = r8817589 - r8817594;
        return r8817595;
}

double f(double x, double y) {
        double r8817596 = y;
        double r8817597 = 3.0;
        double r8817598 = 8.0;
        double r8817599 = r8817597 / r8817598;
        double r8817600 = x;
        double r8817601 = fma(r8817596, r8817599, r8817600);
        double r8817602 = -r8817596;
        double r8817603 = fma(r8817599, r8817602, r8817600);
        double r8817604 = r8817601 / r8817603;
        double r8817605 = r8817601 / r8817604;
        return r8817605;
}

Error

Bits error versus x

Bits error versus y

Derivation

  1. Initial program 0.1

    \[x - \frac{3}{8} \cdot y\]
  2. Using strategy rm
  3. Applied flip--31.7

    \[\leadsto \color{blue}{\frac{x \cdot x - \left(\frac{3}{8} \cdot y\right) \cdot \left(\frac{3}{8} \cdot y\right)}{x + \frac{3}{8} \cdot y}}\]
  4. Using strategy rm
  5. Applied div-inv31.8

    \[\leadsto \color{blue}{\left(x \cdot x - \left(\frac{3}{8} \cdot y\right) \cdot \left(\frac{3}{8} \cdot y\right)\right) \cdot \frac{1}{x + \frac{3}{8} \cdot y}}\]
  6. Using strategy rm
  7. Applied *-un-lft-identity31.8

    \[\leadsto \color{blue}{\left(1 \cdot \left(x \cdot x - \left(\frac{3}{8} \cdot y\right) \cdot \left(\frac{3}{8} \cdot y\right)\right)\right)} \cdot \frac{1}{x + \frac{3}{8} \cdot y}\]
  8. Applied associate-*l*31.8

    \[\leadsto \color{blue}{1 \cdot \left(\left(x \cdot x - \left(\frac{3}{8} \cdot y\right) \cdot \left(\frac{3}{8} \cdot y\right)\right) \cdot \frac{1}{x + \frac{3}{8} \cdot y}\right)}\]
  9. Simplified0.0

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

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

Reproduce

herbie shell --seed 2019171 +o rules:numerics
(FPCore (x y)
  :name "Diagrams.Solve.Polynomial:quartForm  from diagrams-solve-0.1, A"
  (- x (* (/ 3.0 8.0) y)))