Average Error: 13.3 → 0.2
Time: 30.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)\]
\[\mathsf{fma}\left(\frac{\tan y + \tan z}{1 - \frac{\sin y \cdot \sin z}{\cos y \cdot \cos z} \cdot \frac{\sin y \cdot \sin z}{\cos y \cdot \cos z}}, 1 + \frac{\sin y \cdot \sin z}{\cos y \cdot \cos z}, -\tan a\right) + x\]
x + \left(\tan \left(y + z\right) - \tan a\right)
\mathsf{fma}\left(\frac{\tan y + \tan z}{1 - \frac{\sin y \cdot \sin z}{\cos y \cdot \cos z} \cdot \frac{\sin y \cdot \sin z}{\cos y \cdot \cos z}}, 1 + \frac{\sin y \cdot \sin z}{\cos y \cdot \cos z}, -\tan a\right) + x
double f(double x, double y, double z, double a) {
        double r2068712 = x;
        double r2068713 = y;
        double r2068714 = z;
        double r2068715 = r2068713 + r2068714;
        double r2068716 = tan(r2068715);
        double r2068717 = a;
        double r2068718 = tan(r2068717);
        double r2068719 = r2068716 - r2068718;
        double r2068720 = r2068712 + r2068719;
        return r2068720;
}

double f(double x, double y, double z, double a) {
        double r2068721 = y;
        double r2068722 = tan(r2068721);
        double r2068723 = z;
        double r2068724 = tan(r2068723);
        double r2068725 = r2068722 + r2068724;
        double r2068726 = 1.0;
        double r2068727 = sin(r2068721);
        double r2068728 = sin(r2068723);
        double r2068729 = r2068727 * r2068728;
        double r2068730 = cos(r2068721);
        double r2068731 = cos(r2068723);
        double r2068732 = r2068730 * r2068731;
        double r2068733 = r2068729 / r2068732;
        double r2068734 = r2068733 * r2068733;
        double r2068735 = r2068726 - r2068734;
        double r2068736 = r2068725 / r2068735;
        double r2068737 = r2068726 + r2068733;
        double r2068738 = a;
        double r2068739 = tan(r2068738);
        double r2068740 = -r2068739;
        double r2068741 = fma(r2068736, r2068737, r2068740);
        double r2068742 = x;
        double r2068743 = r2068741 + r2068742;
        return r2068743;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus a

Derivation

  1. Initial program 13.3

    \[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 add-log-exp0.3

    \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \color{blue}{\log \left(e^{\tan y \cdot \tan z}\right)}} - \tan a\right)\]
  6. 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)\]
  7. Using strategy rm
  8. Applied flip--0.2

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

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

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

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

Reproduce

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