Average Error: 13.1 → 0.2
Time: 32.6s
Precision: 64
\[\left(x = 0.0 \lor 0.5884141999999999983472775966220069676638 \le x \le 505.5908999999999764440872240811586380005\right) \land \left(-1.7966580000000000931214523812968299911 \cdot 10^{308} \le y \le -9.425585000000013069597555966781986720373 \cdot 10^{-310} \lor 1.284937999999999548796432976649400331091 \cdot 10^{-309} \le y \le 1.751223999999999928063201074847742204824 \cdot 10^{308}\right) \land \left(-1.776707000000000001259808757982040817204 \cdot 10^{308} \le z \le -8.599796000000016667475923823712126825539 \cdot 10^{-310} \lor 3.293144999999983071955117582595641261776 \cdot 10^{-311} \le z \le 1.725154000000000087891269878141591702413 \cdot 10^{308}\right) \land \left(-1.7966580000000000931214523812968299911 \cdot 10^{308} \le a \le -9.425585000000013069597555966781986720373 \cdot 10^{-310} \lor 1.284937999999999548796432976649400331091 \cdot 10^{-309} \le a \le 1.751223999999999928063201074847742204824 \cdot 10^{308}\right)\]
\[x + \left(\tan \left(y + z\right) - \tan a\right)\]
\[x - \left(\left(\tan a - \frac{\left(\tan y + \tan z\right) \cdot \mathsf{fma}\left(\tan z, \tan y, 1\right)}{1 - \tan z \cdot \left(\sqrt[3]{{\left(\tan y \cdot \tan y\right)}^{3}} \cdot \tan z\right)}\right) + \left(\mathsf{fma}\left(\tan z, \tan y, 1\right) + \left(-1 - \tan y \cdot \tan z\right)\right) \cdot \frac{\tan y + \tan z}{1 - \tan z \cdot \left(\left(\tan y \cdot \tan y\right) \cdot \tan z\right)}\right)\]
x + \left(\tan \left(y + z\right) - \tan a\right)
x - \left(\left(\tan a - \frac{\left(\tan y + \tan z\right) \cdot \mathsf{fma}\left(\tan z, \tan y, 1\right)}{1 - \tan z \cdot \left(\sqrt[3]{{\left(\tan y \cdot \tan y\right)}^{3}} \cdot \tan z\right)}\right) + \left(\mathsf{fma}\left(\tan z, \tan y, 1\right) + \left(-1 - \tan y \cdot \tan z\right)\right) \cdot \frac{\tan y + \tan z}{1 - \tan z \cdot \left(\left(\tan y \cdot \tan y\right) \cdot \tan z\right)}\right)
double f(double x, double y, double z, double a) {
        double r148657 = x;
        double r148658 = y;
        double r148659 = z;
        double r148660 = r148658 + r148659;
        double r148661 = tan(r148660);
        double r148662 = a;
        double r148663 = tan(r148662);
        double r148664 = r148661 - r148663;
        double r148665 = r148657 + r148664;
        return r148665;
}

double f(double x, double y, double z, double a) {
        double r148666 = x;
        double r148667 = a;
        double r148668 = tan(r148667);
        double r148669 = y;
        double r148670 = tan(r148669);
        double r148671 = z;
        double r148672 = tan(r148671);
        double r148673 = r148670 + r148672;
        double r148674 = 1.0;
        double r148675 = fma(r148672, r148670, r148674);
        double r148676 = r148673 * r148675;
        double r148677 = r148670 * r148670;
        double r148678 = 3.0;
        double r148679 = pow(r148677, r148678);
        double r148680 = cbrt(r148679);
        double r148681 = r148680 * r148672;
        double r148682 = r148672 * r148681;
        double r148683 = r148674 - r148682;
        double r148684 = r148676 / r148683;
        double r148685 = r148668 - r148684;
        double r148686 = -1.0;
        double r148687 = r148670 * r148672;
        double r148688 = r148686 - r148687;
        double r148689 = r148675 + r148688;
        double r148690 = r148677 * r148672;
        double r148691 = r148672 * r148690;
        double r148692 = r148674 - r148691;
        double r148693 = r148673 / r148692;
        double r148694 = r148689 * r148693;
        double r148695 = r148685 + r148694;
        double r148696 = r148666 - r148695;
        return r148696;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus a

Derivation

  1. Initial program 13.1

    \[x + \left(\tan \left(y + z\right) - \tan a\right)\]
  2. Simplified13.1

    \[\leadsto \color{blue}{x - \left(\tan a - \tan \left(y + z\right)\right)}\]
  3. Using strategy rm
  4. Applied tan-sum0.2

    \[\leadsto x - \left(\tan a - \color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}}\right)\]
  5. Simplified0.2

    \[\leadsto x - \left(\tan a - \frac{\color{blue}{\tan z + \tan y}}{1 - \tan y \cdot \tan z}\right)\]
  6. Simplified0.2

    \[\leadsto x - \left(\tan a - \frac{\tan z + \tan y}{\color{blue}{1 - \tan z \cdot \tan y}}\right)\]
  7. Using strategy rm
  8. Applied flip--0.2

    \[\leadsto x - \left(\tan a - \frac{\tan z + \tan y}{\color{blue}{\frac{1 \cdot 1 - \left(\tan z \cdot \tan y\right) \cdot \left(\tan z \cdot \tan y\right)}{1 + \tan z \cdot \tan y}}}\right)\]
  9. Applied associate-/r/0.2

    \[\leadsto x - \left(\tan a - \color{blue}{\frac{\tan z + \tan y}{1 \cdot 1 - \left(\tan z \cdot \tan y\right) \cdot \left(\tan z \cdot \tan y\right)} \cdot \left(1 + \tan z \cdot \tan y\right)}\right)\]
  10. Applied add-sqr-sqrt32.5

    \[\leadsto x - \left(\color{blue}{\sqrt{\tan a} \cdot \sqrt{\tan a}} - \frac{\tan z + \tan y}{1 \cdot 1 - \left(\tan z \cdot \tan y\right) \cdot \left(\tan z \cdot \tan y\right)} \cdot \left(1 + \tan z \cdot \tan y\right)\right)\]
  11. Applied prod-diff32.5

    \[\leadsto x - \color{blue}{\left(\mathsf{fma}\left(\sqrt{\tan a}, \sqrt{\tan a}, -\left(1 + \tan z \cdot \tan y\right) \cdot \frac{\tan z + \tan y}{1 \cdot 1 - \left(\tan z \cdot \tan y\right) \cdot \left(\tan z \cdot \tan y\right)}\right) + \mathsf{fma}\left(-\left(1 + \tan z \cdot \tan y\right), \frac{\tan z + \tan y}{1 \cdot 1 - \left(\tan z \cdot \tan y\right) \cdot \left(\tan z \cdot \tan y\right)}, \left(1 + \tan z \cdot \tan y\right) \cdot \frac{\tan z + \tan y}{1 \cdot 1 - \left(\tan z \cdot \tan y\right) \cdot \left(\tan z \cdot \tan y\right)}\right)\right)}\]
  12. Simplified0.2

    \[\leadsto x - \left(\color{blue}{\left(\tan a - \frac{\mathsf{fma}\left(\tan z, \tan y, 1\right) \cdot \left(\tan y + \tan z\right)}{1 - \tan z \cdot \left(\left(\tan y \cdot \tan y\right) \cdot \tan z\right)}\right)} + \mathsf{fma}\left(-\left(1 + \tan z \cdot \tan y\right), \frac{\tan z + \tan y}{1 \cdot 1 - \left(\tan z \cdot \tan y\right) \cdot \left(\tan z \cdot \tan y\right)}, \left(1 + \tan z \cdot \tan y\right) \cdot \frac{\tan z + \tan y}{1 \cdot 1 - \left(\tan z \cdot \tan y\right) \cdot \left(\tan z \cdot \tan y\right)}\right)\right)\]
  13. Simplified0.2

    \[\leadsto x - \left(\left(\tan a - \frac{\mathsf{fma}\left(\tan z, \tan y, 1\right) \cdot \left(\tan y + \tan z\right)}{1 - \tan z \cdot \left(\left(\tan y \cdot \tan y\right) \cdot \tan z\right)}\right) + \color{blue}{\frac{\tan y + \tan z}{1 - \tan z \cdot \left(\left(\tan y \cdot \tan y\right) \cdot \tan z\right)} \cdot \left(\left(-1 - \tan y \cdot \tan z\right) + \mathsf{fma}\left(\tan z, \tan y, 1\right)\right)}\right)\]
  14. Using strategy rm
  15. Applied add-cbrt-cube0.2

    \[\leadsto x - \left(\left(\tan a - \frac{\mathsf{fma}\left(\tan z, \tan y, 1\right) \cdot \left(\tan y + \tan z\right)}{1 - \tan z \cdot \left(\left(\tan y \cdot \color{blue}{\sqrt[3]{\left(\tan y \cdot \tan y\right) \cdot \tan y}}\right) \cdot \tan z\right)}\right) + \frac{\tan y + \tan z}{1 - \tan z \cdot \left(\left(\tan y \cdot \tan y\right) \cdot \tan z\right)} \cdot \left(\left(-1 - \tan y \cdot \tan z\right) + \mathsf{fma}\left(\tan z, \tan y, 1\right)\right)\right)\]
  16. Applied add-cbrt-cube0.2

    \[\leadsto x - \left(\left(\tan a - \frac{\mathsf{fma}\left(\tan z, \tan y, 1\right) \cdot \left(\tan y + \tan z\right)}{1 - \tan z \cdot \left(\left(\color{blue}{\sqrt[3]{\left(\tan y \cdot \tan y\right) \cdot \tan y}} \cdot \sqrt[3]{\left(\tan y \cdot \tan y\right) \cdot \tan y}\right) \cdot \tan z\right)}\right) + \frac{\tan y + \tan z}{1 - \tan z \cdot \left(\left(\tan y \cdot \tan y\right) \cdot \tan z\right)} \cdot \left(\left(-1 - \tan y \cdot \tan z\right) + \mathsf{fma}\left(\tan z, \tan y, 1\right)\right)\right)\]
  17. Applied cbrt-unprod0.2

    \[\leadsto x - \left(\left(\tan a - \frac{\mathsf{fma}\left(\tan z, \tan y, 1\right) \cdot \left(\tan y + \tan z\right)}{1 - \tan z \cdot \left(\color{blue}{\sqrt[3]{\left(\left(\tan y \cdot \tan y\right) \cdot \tan y\right) \cdot \left(\left(\tan y \cdot \tan y\right) \cdot \tan y\right)}} \cdot \tan z\right)}\right) + \frac{\tan y + \tan z}{1 - \tan z \cdot \left(\left(\tan y \cdot \tan y\right) \cdot \tan z\right)} \cdot \left(\left(-1 - \tan y \cdot \tan z\right) + \mathsf{fma}\left(\tan z, \tan y, 1\right)\right)\right)\]
  18. Simplified0.2

    \[\leadsto x - \left(\left(\tan a - \frac{\mathsf{fma}\left(\tan z, \tan y, 1\right) \cdot \left(\tan y + \tan z\right)}{1 - \tan z \cdot \left(\sqrt[3]{\color{blue}{{\left(\tan y \cdot \tan y\right)}^{3}}} \cdot \tan z\right)}\right) + \frac{\tan y + \tan z}{1 - \tan z \cdot \left(\left(\tan y \cdot \tan y\right) \cdot \tan z\right)} \cdot \left(\left(-1 - \tan y \cdot \tan z\right) + \mathsf{fma}\left(\tan z, \tan y, 1\right)\right)\right)\]
  19. Final simplification0.2

    \[\leadsto x - \left(\left(\tan a - \frac{\left(\tan y + \tan z\right) \cdot \mathsf{fma}\left(\tan z, \tan y, 1\right)}{1 - \tan z \cdot \left(\sqrt[3]{{\left(\tan y \cdot \tan y\right)}^{3}} \cdot \tan z\right)}\right) + \left(\mathsf{fma}\left(\tan z, \tan y, 1\right) + \left(-1 - \tan y \cdot \tan z\right)\right) \cdot \frac{\tan y + \tan z}{1 - \tan z \cdot \left(\left(\tan y \cdot \tan y\right) \cdot \tan z\right)}\right)\]

Reproduce

herbie shell --seed 2019194 +o rules:numerics
(FPCore (x y z a)
  :name "(+ x (- (tan (+ y z)) (tan a)))"
  :pre (and (or (== x 0.0) (<= 0.5884142 x 505.5909)) (or (<= -1.796658e+308 y -9.425585e-310) (<= 1.284938e-309 y 1.751224e+308)) (or (<= -1.776707e+308 z -8.599796e-310) (<= 3.293145e-311 z 1.725154e+308)) (or (<= -1.796658e+308 a -9.425585e-310) (<= 1.284938e-309 a 1.751224e+308)))
  (+ x (- (tan (+ y z)) (tan a))))