Average Error: 12.9 → 0.2
Time: 39.6s
Precision: 64
\[\left(x = 0 \lor 0.5884142 \le x \le 505.5909\right) \land \left(-1.796658 \cdot 10^{+308} \le y \le -9.425585 \cdot 10^{-310} \lor 1.284938 \cdot 10^{-309} \le y \le 1.751224 \cdot 10^{+308}\right) \land \left(-1.776707 \cdot 10^{+308} \le z \le -8.599796 \cdot 10^{-310} \lor 3.293145 \cdot 10^{-311} \le z \le 1.725154 \cdot 10^{+308}\right) \land \left(-1.796658 \cdot 10^{+308} \le a \le -9.425585 \cdot 10^{-310} \lor 1.284938 \cdot 10^{-309} \le a \le 1.751224 \cdot 10^{+308}\right)\]
\[x + \left(\tan \left(y + z\right) - \tan a\right)\]
\[x + \frac{\frac{\cos a \cdot \left(\tan y + \tan z\right) - \left(1 - \tan z \cdot \tan y\right) \cdot \sin a}{1 - \frac{\sin z \cdot \tan y}{\cos z}}}{\cos a}\]
x + \left(\tan \left(y + z\right) - \tan a\right)
x + \frac{\frac{\cos a \cdot \left(\tan y + \tan z\right) - \left(1 - \tan z \cdot \tan y\right) \cdot \sin a}{1 - \frac{\sin z \cdot \tan y}{\cos z}}}{\cos a}
double f(double x, double y, double z, double a) {
        double r5441906 = x;
        double r5441907 = y;
        double r5441908 = z;
        double r5441909 = r5441907 + r5441908;
        double r5441910 = tan(r5441909);
        double r5441911 = a;
        double r5441912 = tan(r5441911);
        double r5441913 = r5441910 - r5441912;
        double r5441914 = r5441906 + r5441913;
        return r5441914;
}

double f(double x, double y, double z, double a) {
        double r5441915 = x;
        double r5441916 = a;
        double r5441917 = cos(r5441916);
        double r5441918 = y;
        double r5441919 = tan(r5441918);
        double r5441920 = z;
        double r5441921 = tan(r5441920);
        double r5441922 = r5441919 + r5441921;
        double r5441923 = r5441917 * r5441922;
        double r5441924 = 1.0;
        double r5441925 = r5441921 * r5441919;
        double r5441926 = r5441924 - r5441925;
        double r5441927 = sin(r5441916);
        double r5441928 = r5441926 * r5441927;
        double r5441929 = r5441923 - r5441928;
        double r5441930 = sin(r5441920);
        double r5441931 = r5441930 * r5441919;
        double r5441932 = cos(r5441920);
        double r5441933 = r5441931 / r5441932;
        double r5441934 = r5441924 - r5441933;
        double r5441935 = r5441929 / r5441934;
        double r5441936 = r5441935 / r5441917;
        double r5441937 = r5441915 + r5441936;
        return r5441937;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus a

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 12.9

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

    \[\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. Using strategy rm
  7. Applied tan-quot0.2

    \[\leadsto x + \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 \color{blue}{\frac{\sin z}{\cos z}}\right) \cdot \cos a}\]
  8. Applied associate-*r/0.2

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

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

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

Reproduce

herbie shell --seed 2019163 +o rules:numerics
(FPCore (x y z a)
  :name "(+ x (- (tan (+ y z)) (tan a)))"
  :pre (and (or (== x 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))))