Average Error: 13.2 → 0.2
Time: 32.9s
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 + \frac{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\tan z, \tan y, -1\right), \sin a, \left(\tan y + \tan z\right) \cdot \cos a\right)}{1 - \left(\tan z \cdot \tan y\right) \cdot \left(\tan z \cdot \tan y\right)}}{\cos a} \cdot \left(1 + \tan y \cdot \tan z\right)\]
x + \left(\tan \left(y + z\right) - \tan a\right)
x + \frac{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\tan z, \tan y, -1\right), \sin a, \left(\tan y + \tan z\right) \cdot \cos a\right)}{1 - \left(\tan z \cdot \tan y\right) \cdot \left(\tan z \cdot \tan y\right)}}{\cos a} \cdot \left(1 + \tan y \cdot \tan z\right)
double f(double x, double y, double z, double a) {
        double r118744 = x;
        double r118745 = y;
        double r118746 = z;
        double r118747 = r118745 + r118746;
        double r118748 = tan(r118747);
        double r118749 = a;
        double r118750 = tan(r118749);
        double r118751 = r118748 - r118750;
        double r118752 = r118744 + r118751;
        return r118752;
}

double f(double x, double y, double z, double a) {
        double r118753 = x;
        double r118754 = z;
        double r118755 = tan(r118754);
        double r118756 = y;
        double r118757 = tan(r118756);
        double r118758 = -1.0;
        double r118759 = fma(r118755, r118757, r118758);
        double r118760 = a;
        double r118761 = sin(r118760);
        double r118762 = r118757 + r118755;
        double r118763 = cos(r118760);
        double r118764 = r118762 * r118763;
        double r118765 = fma(r118759, r118761, r118764);
        double r118766 = 1.0;
        double r118767 = r118755 * r118757;
        double r118768 = r118767 * r118767;
        double r118769 = r118766 - r118768;
        double r118770 = r118765 / r118769;
        double r118771 = r118770 / r118763;
        double r118772 = r118757 * r118755;
        double r118773 = r118766 + r118772;
        double r118774 = r118771 * r118773;
        double r118775 = r118753 + r118774;
        return r118775;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus a

Derivation

  1. Initial program 13.2

    \[x + \left(\tan \left(y + z\right) - \tan a\right)\]
  2. Using strategy rm
  3. Applied tan-quot13.2

    \[\leadsto x + \left(\tan \left(y + z\right) - \color{blue}{\frac{\sin a}{\cos a}}\right)\]
  4. Applied tan-sum0.2

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

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

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

    \[\leadsto x + \frac{\mathsf{fma}\left(\tan z \cdot \tan y + -1, \sin a, \left(\tan y + \tan z\right) \cdot \cos a\right)}{\color{blue}{\frac{1 \cdot 1 - \left(\tan y \cdot \tan z\right) \cdot \left(\tan y \cdot \tan z\right)}{1 + \tan y \cdot \tan z}} \cdot \cos a}\]
  9. Applied associate-*l/0.2

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

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

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

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

Reproduce

herbie shell --seed 2019303 +o rules:numerics
(FPCore (x y z a)
  :name "(+ x (- (tan (+ y z)) (tan a)))"
  :precision binary64
  :pre (and (or (== x 0.0) (<= 0.588414199999999998 x 505.590899999999976)) (or (<= -1.79665800000000009e308 y -9.425585000000013e-310) (<= 1.284938e-309 y 1.75122399999999993e308)) (or (<= -1.776707e308 z -8.59979600000002e-310) (<= 3.29314499999998e-311 z 1.72515400000000009e308)) (or (<= -1.79665800000000009e308 a -9.425585000000013e-310) (<= 1.284938e-309 a 1.75122399999999993e308)))
  (+ x (- (tan (+ y z)) (tan a))))