Average Error: 0.5 → 0.3
Time: 36.7s
Precision: 64
\[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right)\]
\[\mathsf{fma}\left(\left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 - x1\right) - x2 \cdot 2}{\mathsf{fma}\left(x1, x1, 1\right)}\right), 3, \left(x1 + \mathsf{fma}\left(\left(\mathsf{fma}\left(x1, x1, 1\right)\right), x1, \left(\mathsf{fma}\left(\left(\frac{\mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}\right), \left(\left(3 \cdot x1\right) \cdot x1\right), \left(\mathsf{fma}\left(x1, x1, 1\right) \cdot \mathsf{fma}\left(\left(\mathsf{fma}\left(\left(\frac{\mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}\right), 4, -6\right)\right), \left(x1 \cdot x1\right), \left(\frac{\left(\mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right) \cdot \left(2 \cdot x1\right)\right) \cdot \mathsf{fma}\left(\left(\mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)\right), \left(\frac{1}{\mathsf{fma}\left(x1, x1, 1\right)}\right), -3\right)}{\mathsf{fma}\left(x1, x1, 1\right)}\right)\right)\right)\right)\right)\right)\right)\right)\]
x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right)
\mathsf{fma}\left(\left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 - x1\right) - x2 \cdot 2}{\mathsf{fma}\left(x1, x1, 1\right)}\right), 3, \left(x1 + \mathsf{fma}\left(\left(\mathsf{fma}\left(x1, x1, 1\right)\right), x1, \left(\mathsf{fma}\left(\left(\frac{\mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}\right), \left(\left(3 \cdot x1\right) \cdot x1\right), \left(\mathsf{fma}\left(x1, x1, 1\right) \cdot \mathsf{fma}\left(\left(\mathsf{fma}\left(\left(\frac{\mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}\right), 4, -6\right)\right), \left(x1 \cdot x1\right), \left(\frac{\left(\mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right) \cdot \left(2 \cdot x1\right)\right) \cdot \mathsf{fma}\left(\left(\mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)\right), \left(\frac{1}{\mathsf{fma}\left(x1, x1, 1\right)}\right), -3\right)}{\mathsf{fma}\left(x1, x1, 1\right)}\right)\right)\right)\right)\right)\right)\right)\right)
double f(double x1, double x2) {
        double r1359611 = x1;
        double r1359612 = 2.0;
        double r1359613 = r1359612 * r1359611;
        double r1359614 = 3.0;
        double r1359615 = r1359614 * r1359611;
        double r1359616 = r1359615 * r1359611;
        double r1359617 = x2;
        double r1359618 = r1359612 * r1359617;
        double r1359619 = r1359616 + r1359618;
        double r1359620 = r1359619 - r1359611;
        double r1359621 = r1359611 * r1359611;
        double r1359622 = 1.0;
        double r1359623 = r1359621 + r1359622;
        double r1359624 = r1359620 / r1359623;
        double r1359625 = r1359613 * r1359624;
        double r1359626 = r1359624 - r1359614;
        double r1359627 = r1359625 * r1359626;
        double r1359628 = 4.0;
        double r1359629 = r1359628 * r1359624;
        double r1359630 = 6.0;
        double r1359631 = r1359629 - r1359630;
        double r1359632 = r1359621 * r1359631;
        double r1359633 = r1359627 + r1359632;
        double r1359634 = r1359633 * r1359623;
        double r1359635 = r1359616 * r1359624;
        double r1359636 = r1359634 + r1359635;
        double r1359637 = r1359621 * r1359611;
        double r1359638 = r1359636 + r1359637;
        double r1359639 = r1359638 + r1359611;
        double r1359640 = r1359616 - r1359618;
        double r1359641 = r1359640 - r1359611;
        double r1359642 = r1359641 / r1359623;
        double r1359643 = r1359614 * r1359642;
        double r1359644 = r1359639 + r1359643;
        double r1359645 = r1359611 + r1359644;
        return r1359645;
}

double f(double x1, double x2) {
        double r1359646 = 3.0;
        double r1359647 = x1;
        double r1359648 = r1359646 * r1359647;
        double r1359649 = r1359648 * r1359647;
        double r1359650 = r1359649 - r1359647;
        double r1359651 = x2;
        double r1359652 = 2.0;
        double r1359653 = r1359651 * r1359652;
        double r1359654 = r1359650 - r1359653;
        double r1359655 = 1.0;
        double r1359656 = fma(r1359647, r1359647, r1359655);
        double r1359657 = r1359654 / r1359656;
        double r1359658 = r1359647 * r1359647;
        double r1359659 = r1359653 - r1359647;
        double r1359660 = fma(r1359646, r1359658, r1359659);
        double r1359661 = r1359660 / r1359656;
        double r1359662 = 4.0;
        double r1359663 = -6.0;
        double r1359664 = fma(r1359661, r1359662, r1359663);
        double r1359665 = r1359652 * r1359647;
        double r1359666 = r1359660 * r1359665;
        double r1359667 = r1359655 / r1359656;
        double r1359668 = -3.0;
        double r1359669 = fma(r1359660, r1359667, r1359668);
        double r1359670 = r1359666 * r1359669;
        double r1359671 = r1359670 / r1359656;
        double r1359672 = fma(r1359664, r1359658, r1359671);
        double r1359673 = r1359656 * r1359672;
        double r1359674 = fma(r1359661, r1359649, r1359673);
        double r1359675 = fma(r1359656, r1359647, r1359674);
        double r1359676 = r1359647 + r1359675;
        double r1359677 = fma(r1359657, r1359646, r1359676);
        return r1359677;
}

Error

Bits error versus x1

Bits error versus x2

Derivation

  1. Initial program 0.5

    \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right)\]
  2. Simplified0.3

    \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 - x1\right) - x2 \cdot 2}{\mathsf{fma}\left(x1, x1, 1\right)}\right), 3, \left(x1 + \mathsf{fma}\left(\left(\mathsf{fma}\left(x1, x1, 1\right)\right), x1, \left(\mathsf{fma}\left(\left(\frac{\mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}\right), \left(\left(3 \cdot x1\right) \cdot x1\right), \left(\mathsf{fma}\left(x1, x1, 1\right) \cdot \mathsf{fma}\left(\left(\mathsf{fma}\left(\left(\frac{\mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}\right), 4, -6\right)\right), \left(x1 \cdot x1\right), \left(\left(\frac{\mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} - 3\right) \cdot \left(\left(x1 \cdot 2\right) \cdot \frac{\mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}\right)\right)\right)\right)\right)\right)\right)\right)\right)}\]
  3. Using strategy rm
  4. Applied associate-*r/0.3

    \[\leadsto \mathsf{fma}\left(\left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 - x1\right) - x2 \cdot 2}{\mathsf{fma}\left(x1, x1, 1\right)}\right), 3, \left(x1 + \mathsf{fma}\left(\left(\mathsf{fma}\left(x1, x1, 1\right)\right), x1, \left(\mathsf{fma}\left(\left(\frac{\mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}\right), \left(\left(3 \cdot x1\right) \cdot x1\right), \left(\mathsf{fma}\left(x1, x1, 1\right) \cdot \mathsf{fma}\left(\left(\mathsf{fma}\left(\left(\frac{\mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}\right), 4, -6\right)\right), \left(x1 \cdot x1\right), \left(\left(\frac{\mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} - 3\right) \cdot \color{blue}{\frac{\left(x1 \cdot 2\right) \cdot \mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}}\right)\right)\right)\right)\right)\right)\right)\right)\]
  5. Applied associate-*r/0.3

    \[\leadsto \mathsf{fma}\left(\left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 - x1\right) - x2 \cdot 2}{\mathsf{fma}\left(x1, x1, 1\right)}\right), 3, \left(x1 + \mathsf{fma}\left(\left(\mathsf{fma}\left(x1, x1, 1\right)\right), x1, \left(\mathsf{fma}\left(\left(\frac{\mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}\right), \left(\left(3 \cdot x1\right) \cdot x1\right), \left(\mathsf{fma}\left(x1, x1, 1\right) \cdot \mathsf{fma}\left(\left(\mathsf{fma}\left(\left(\frac{\mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}\right), 4, -6\right)\right), \left(x1 \cdot x1\right), \color{blue}{\left(\frac{\left(\frac{\mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} - 3\right) \cdot \left(\left(x1 \cdot 2\right) \cdot \mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}\right)}\right)\right)\right)\right)\right)\right)\right)\]
  6. Using strategy rm
  7. Applied div-inv0.3

    \[\leadsto \mathsf{fma}\left(\left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 - x1\right) - x2 \cdot 2}{\mathsf{fma}\left(x1, x1, 1\right)}\right), 3, \left(x1 + \mathsf{fma}\left(\left(\mathsf{fma}\left(x1, x1, 1\right)\right), x1, \left(\mathsf{fma}\left(\left(\frac{\mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}\right), \left(\left(3 \cdot x1\right) \cdot x1\right), \left(\mathsf{fma}\left(x1, x1, 1\right) \cdot \mathsf{fma}\left(\left(\mathsf{fma}\left(\left(\frac{\mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}\right), 4, -6\right)\right), \left(x1 \cdot x1\right), \left(\frac{\left(\color{blue}{\mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right) \cdot \frac{1}{\mathsf{fma}\left(x1, x1, 1\right)}} - 3\right) \cdot \left(\left(x1 \cdot 2\right) \cdot \mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}\right)\right)\right)\right)\right)\right)\right)\right)\]
  8. Applied fma-neg0.3

    \[\leadsto \mathsf{fma}\left(\left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 - x1\right) - x2 \cdot 2}{\mathsf{fma}\left(x1, x1, 1\right)}\right), 3, \left(x1 + \mathsf{fma}\left(\left(\mathsf{fma}\left(x1, x1, 1\right)\right), x1, \left(\mathsf{fma}\left(\left(\frac{\mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}\right), \left(\left(3 \cdot x1\right) \cdot x1\right), \left(\mathsf{fma}\left(x1, x1, 1\right) \cdot \mathsf{fma}\left(\left(\mathsf{fma}\left(\left(\frac{\mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}\right), 4, -6\right)\right), \left(x1 \cdot x1\right), \left(\frac{\color{blue}{\mathsf{fma}\left(\left(\mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)\right), \left(\frac{1}{\mathsf{fma}\left(x1, x1, 1\right)}\right), \left(-3\right)\right)} \cdot \left(\left(x1 \cdot 2\right) \cdot \mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}\right)\right)\right)\right)\right)\right)\right)\right)\]
  9. Simplified0.3

    \[\leadsto \mathsf{fma}\left(\left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 - x1\right) - x2 \cdot 2}{\mathsf{fma}\left(x1, x1, 1\right)}\right), 3, \left(x1 + \mathsf{fma}\left(\left(\mathsf{fma}\left(x1, x1, 1\right)\right), x1, \left(\mathsf{fma}\left(\left(\frac{\mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}\right), \left(\left(3 \cdot x1\right) \cdot x1\right), \left(\mathsf{fma}\left(x1, x1, 1\right) \cdot \mathsf{fma}\left(\left(\mathsf{fma}\left(\left(\frac{\mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}\right), 4, -6\right)\right), \left(x1 \cdot x1\right), \left(\frac{\mathsf{fma}\left(\left(\mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)\right), \left(\frac{1}{\mathsf{fma}\left(x1, x1, 1\right)}\right), \color{blue}{-3}\right) \cdot \left(\left(x1 \cdot 2\right) \cdot \mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}\right)\right)\right)\right)\right)\right)\right)\right)\]
  10. Final simplification0.3

    \[\leadsto \mathsf{fma}\left(\left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 - x1\right) - x2 \cdot 2}{\mathsf{fma}\left(x1, x1, 1\right)}\right), 3, \left(x1 + \mathsf{fma}\left(\left(\mathsf{fma}\left(x1, x1, 1\right)\right), x1, \left(\mathsf{fma}\left(\left(\frac{\mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}\right), \left(\left(3 \cdot x1\right) \cdot x1\right), \left(\mathsf{fma}\left(x1, x1, 1\right) \cdot \mathsf{fma}\left(\left(\mathsf{fma}\left(\left(\frac{\mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}\right), 4, -6\right)\right), \left(x1 \cdot x1\right), \left(\frac{\left(\mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right) \cdot \left(2 \cdot x1\right)\right) \cdot \mathsf{fma}\left(\left(\mathsf{fma}\left(3, \left(x1 \cdot x1\right), \left(x2 \cdot 2 - x1\right)\right)\right), \left(\frac{1}{\mathsf{fma}\left(x1, x1, 1\right)}\right), -3\right)}{\mathsf{fma}\left(x1, x1, 1\right)}\right)\right)\right)\right)\right)\right)\right)\right)\]

Reproduce

herbie shell --seed 2019132 +o rules:numerics
(FPCore (x1 x2)
  :name "Rosa's FloatVsDoubleBenchmark"
  (+ x1 (+ (+ (+ (+ (* (+ (* (* (* 2 x1) (/ (- (+ (* (* 3 x1) x1) (* 2 x2)) x1) (+ (* x1 x1) 1))) (- (/ (- (+ (* (* 3 x1) x1) (* 2 x2)) x1) (+ (* x1 x1) 1)) 3)) (* (* x1 x1) (- (* 4 (/ (- (+ (* (* 3 x1) x1) (* 2 x2)) x1) (+ (* x1 x1) 1))) 6))) (+ (* x1 x1) 1)) (* (* (* 3 x1) x1) (/ (- (+ (* (* 3 x1) x1) (* 2 x2)) x1) (+ (* x1 x1) 1)))) (* (* x1 x1) x1)) x1) (* 3 (/ (- (- (* (* 3 x1) x1) (* 2 x2)) x1) (+ (* x1 x1) 1))))))