Average Error: 13.2 → 0.3
Time: 41.7s
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)\]
\[\frac{\log \left(e^{\frac{\cos a}{\frac{1 - \tan z \cdot \tan y}{\tan y + \tan z}}}\right) - \sin a}{\cos a} + x\]
x + \left(\tan \left(y + z\right) - \tan a\right)
\frac{\log \left(e^{\frac{\cos a}{\frac{1 - \tan z \cdot \tan y}{\tan y + \tan z}}}\right) - \sin a}{\cos a} + x
double f(double x, double y, double z, double a) {
        double r4690516 = x;
        double r4690517 = y;
        double r4690518 = z;
        double r4690519 = r4690517 + r4690518;
        double r4690520 = tan(r4690519);
        double r4690521 = a;
        double r4690522 = tan(r4690521);
        double r4690523 = r4690520 - r4690522;
        double r4690524 = r4690516 + r4690523;
        return r4690524;
}

double f(double x, double y, double z, double a) {
        double r4690525 = a;
        double r4690526 = cos(r4690525);
        double r4690527 = 1.0;
        double r4690528 = z;
        double r4690529 = tan(r4690528);
        double r4690530 = y;
        double r4690531 = tan(r4690530);
        double r4690532 = r4690529 * r4690531;
        double r4690533 = r4690527 - r4690532;
        double r4690534 = r4690531 + r4690529;
        double r4690535 = r4690533 / r4690534;
        double r4690536 = r4690526 / r4690535;
        double r4690537 = exp(r4690536);
        double r4690538 = log(r4690537);
        double r4690539 = sin(r4690525);
        double r4690540 = r4690538 - r4690539;
        double r4690541 = r4690540 / r4690526;
        double r4690542 = x;
        double r4690543 = r4690541 + r4690542;
        return r4690543;
}

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.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. Using strategy rm
  7. 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 - \tan y \cdot \tan z}}{\cos a}}\]
  8. Simplified0.2

    \[\leadsto x + \frac{\color{blue}{\frac{\cos a}{\frac{1 - \tan y \cdot \tan z}{\tan z + \tan y}} - \sin a}}{\cos a}\]
  9. Using strategy rm
  10. Applied add-log-exp0.3

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

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

Reproduce

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