Average Error: 13.0 → 0.2
Time: 34.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)\]
\[\frac{\cos a \cdot \left(\tan y + \tan z\right) - \sin a \cdot \left(1 - \frac{\sin z \cdot \sin y}{\cos z \cdot \cos y}\right)}{\left(1 - \frac{\sin z \cdot \sin y}{\cos z \cdot \cos y}\right) \cdot \cos a} + x\]
x + \left(\tan \left(y + z\right) - \tan a\right)
\frac{\cos a \cdot \left(\tan y + \tan z\right) - \sin a \cdot \left(1 - \frac{\sin z \cdot \sin y}{\cos z \cdot \cos y}\right)}{\left(1 - \frac{\sin z \cdot \sin y}{\cos z \cdot \cos y}\right) \cdot \cos a} + x
double f(double x, double y, double z, double a) {
        double r5412034 = x;
        double r5412035 = y;
        double r5412036 = z;
        double r5412037 = r5412035 + r5412036;
        double r5412038 = tan(r5412037);
        double r5412039 = a;
        double r5412040 = tan(r5412039);
        double r5412041 = r5412038 - r5412040;
        double r5412042 = r5412034 + r5412041;
        return r5412042;
}

double f(double x, double y, double z, double a) {
        double r5412043 = a;
        double r5412044 = cos(r5412043);
        double r5412045 = y;
        double r5412046 = tan(r5412045);
        double r5412047 = z;
        double r5412048 = tan(r5412047);
        double r5412049 = r5412046 + r5412048;
        double r5412050 = r5412044 * r5412049;
        double r5412051 = sin(r5412043);
        double r5412052 = 1.0;
        double r5412053 = sin(r5412047);
        double r5412054 = sin(r5412045);
        double r5412055 = r5412053 * r5412054;
        double r5412056 = cos(r5412047);
        double r5412057 = cos(r5412045);
        double r5412058 = r5412056 * r5412057;
        double r5412059 = r5412055 / r5412058;
        double r5412060 = r5412052 - r5412059;
        double r5412061 = r5412051 * r5412060;
        double r5412062 = r5412050 - r5412061;
        double r5412063 = r5412060 * r5412044;
        double r5412064 = r5412062 / r5412063;
        double r5412065 = x;
        double r5412066 = r5412064 + r5412065;
        return r5412066;
}

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 13.0

    \[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. Taylor expanded around inf 0.2

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

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

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

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

Reproduce

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