Average Error: 12.9 → 0.2
Time: 1.5m
Precision: 64
\[x + \left(\tan \left(y + z\right) - \tan a\right)\]
\[\left(\frac{1}{1 - \tan y \cdot \tan z} \cdot \frac{(\left(\sin z\right) \cdot \left(\cos y\right) + \left(\cos z \cdot \sin y\right))_*}{\cos y \cdot \cos z} - \tan a\right) + x\]
double f(double x, double y, double z, double a) {
        double r28735900 = x;
        double r28735901 = y;
        double r28735902 = z;
        double r28735903 = r28735901 + r28735902;
        double r28735904 = tan(r28735903);
        double r28735905 = a;
        double r28735906 = tan(r28735905);
        double r28735907 = r28735904 - r28735906;
        double r28735908 = r28735900 + r28735907;
        return r28735908;
}

double f(double x, double y, double z, double a) {
        double r28735909 = 1.0;
        double r28735910 = y;
        double r28735911 = tan(r28735910);
        double r28735912 = z;
        double r28735913 = tan(r28735912);
        double r28735914 = r28735911 * r28735913;
        double r28735915 = r28735909 - r28735914;
        double r28735916 = r28735909 / r28735915;
        double r28735917 = sin(r28735912);
        double r28735918 = cos(r28735910);
        double r28735919 = cos(r28735912);
        double r28735920 = sin(r28735910);
        double r28735921 = r28735919 * r28735920;
        double r28735922 = fma(r28735917, r28735918, r28735921);
        double r28735923 = r28735918 * r28735919;
        double r28735924 = r28735922 / r28735923;
        double r28735925 = r28735916 * r28735924;
        double r28735926 = a;
        double r28735927 = tan(r28735926);
        double r28735928 = r28735925 - r28735927;
        double r28735929 = x;
        double r28735930 = r28735928 + r28735929;
        return r28735930;
}

x + \left(\tan \left(y + z\right) - \tan a\right)
\left(\frac{1}{1 - \tan y \cdot \tan z} \cdot \frac{(\left(\sin z\right) \cdot \left(\cos y\right) + \left(\cos z \cdot \sin y\right))_*}{\cos y \cdot \cos z} - \tan a\right) + x

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus a

Derivation

  1. Initial program 12.9

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

    \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} - \tan a\right)\]
  4. Using strategy rm
  5. Applied tan-quot0.2

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

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

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

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

    \[\leadsto x + \left(\frac{\color{blue}{(\left(\sin z\right) \cdot \left(\cos y\right) + \left(\cos z \cdot \sin y\right))_*}}{\left(1 - \tan y \cdot \tan z\right) \cdot \left(\cos y \cdot \cos z\right)} - \tan a\right)\]
  10. Using strategy rm
  11. Applied *-un-lft-identity0.2

    \[\leadsto x + \left(\frac{\color{blue}{1 \cdot (\left(\sin z\right) \cdot \left(\cos y\right) + \left(\cos z \cdot \sin y\right))_*}}{\left(1 - \tan y \cdot \tan z\right) \cdot \left(\cos y \cdot \cos z\right)} - \tan a\right)\]
  12. Applied times-frac0.2

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

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

Reproduce

herbie shell --seed 2019102 +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))))