Average Error: 0.0 → 0.0
Time: 9.0s
Precision: 64
\[x + y \cdot \left(z - x\right)\]
\[\mathsf{fma}\left(z, y, x\right) - x \cdot y\]
x + y \cdot \left(z - x\right)
\mathsf{fma}\left(z, y, x\right) - x \cdot y
double f(double x, double y, double z) {
        double r12683 = x;
        double r12684 = y;
        double r12685 = z;
        double r12686 = r12685 - r12683;
        double r12687 = r12684 * r12686;
        double r12688 = r12683 + r12687;
        return r12688;
}

double f(double x, double y, double z) {
        double r12689 = z;
        double r12690 = y;
        double r12691 = x;
        double r12692 = fma(r12689, r12690, r12691);
        double r12693 = r12691 * r12690;
        double r12694 = r12692 - r12693;
        return r12694;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Initial program 0.0

    \[x + y \cdot \left(z - x\right)\]
  2. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(z - x, y, x\right)}\]
  3. Using strategy rm
  4. Applied add-sqr-sqrt31.8

    \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(z - x, y, x\right)} \cdot \sqrt{\mathsf{fma}\left(z - x, y, x\right)}}\]
  5. Using strategy rm
  6. Applied add-sqr-sqrt31.8

    \[\leadsto \sqrt{\color{blue}{\sqrt{\mathsf{fma}\left(z - x, y, x\right)} \cdot \sqrt{\mathsf{fma}\left(z - x, y, x\right)}}} \cdot \sqrt{\mathsf{fma}\left(z - x, y, x\right)}\]
  7. Applied sqrt-prod31.9

    \[\leadsto \color{blue}{\left(\sqrt{\sqrt{\mathsf{fma}\left(z - x, y, x\right)}} \cdot \sqrt{\sqrt{\mathsf{fma}\left(z - x, y, x\right)}}\right)} \cdot \sqrt{\mathsf{fma}\left(z - x, y, x\right)}\]
  8. Using strategy rm
  9. Applied add-sqr-sqrt31.9

    \[\leadsto \left(\sqrt{\sqrt{\color{blue}{\sqrt{\mathsf{fma}\left(z - x, y, x\right)} \cdot \sqrt{\mathsf{fma}\left(z - x, y, x\right)}}}} \cdot \sqrt{\sqrt{\mathsf{fma}\left(z - x, y, x\right)}}\right) \cdot \sqrt{\mathsf{fma}\left(z - x, y, x\right)}\]
  10. Applied sqrt-prod31.9

    \[\leadsto \left(\sqrt{\color{blue}{\sqrt{\sqrt{\mathsf{fma}\left(z - x, y, x\right)}} \cdot \sqrt{\sqrt{\mathsf{fma}\left(z - x, y, x\right)}}}} \cdot \sqrt{\sqrt{\mathsf{fma}\left(z - x, y, x\right)}}\right) \cdot \sqrt{\mathsf{fma}\left(z - x, y, x\right)}\]
  11. Applied sqrt-prod32.0

    \[\leadsto \left(\color{blue}{\left(\sqrt{\sqrt{\sqrt{\mathsf{fma}\left(z - x, y, x\right)}}} \cdot \sqrt{\sqrt{\sqrt{\mathsf{fma}\left(z - x, y, x\right)}}}\right)} \cdot \sqrt{\sqrt{\mathsf{fma}\left(z - x, y, x\right)}}\right) \cdot \sqrt{\mathsf{fma}\left(z - x, y, x\right)}\]
  12. Applied associate-*l*32.0

    \[\leadsto \color{blue}{\left(\sqrt{\sqrt{\sqrt{\mathsf{fma}\left(z - x, y, x\right)}}} \cdot \left(\sqrt{\sqrt{\sqrt{\mathsf{fma}\left(z - x, y, x\right)}}} \cdot \sqrt{\sqrt{\mathsf{fma}\left(z - x, y, x\right)}}\right)\right)} \cdot \sqrt{\mathsf{fma}\left(z - x, y, x\right)}\]
  13. Simplified32.1

    \[\leadsto \left(\sqrt{\sqrt{\sqrt{\mathsf{fma}\left(z - x, y, x\right)}}} \cdot \color{blue}{{\left(\sqrt{\sqrt{\sqrt{\mathsf{fma}\left(z - x, y, x\right)}}}\right)}^{3}}\right) \cdot \sqrt{\mathsf{fma}\left(z - x, y, x\right)}\]
  14. Taylor expanded around 0 0.0

    \[\leadsto \color{blue}{\left(z \cdot y + x\right) - x \cdot y}\]
  15. Simplified0.0

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

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

Reproduce

herbie shell --seed 2020045 +o rules:numerics
(FPCore (x y z)
  :name "SynthBasics:oscSampleBasedAux from YampaSynth-0.2"
  :precision binary64
  (+ x (* y (- z x))))