Average Error: 13.3 → 0.2
Time: 2.5m
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 + \left(\frac{\frac{\frac{\mathsf{fma}\left(\left(\cos y\right), \left(\sin z\right), \left(\sin y \cdot \cos z\right)\right)}{\cos z}}{\cos y}}{1 - \tan z \cdot \tan y} - \tan a\right)\]
x + \left(\tan \left(y + z\right) - \tan a\right)
x + \left(\frac{\frac{\frac{\mathsf{fma}\left(\left(\cos y\right), \left(\sin z\right), \left(\sin y \cdot \cos z\right)\right)}{\cos z}}{\cos y}}{1 - \tan z \cdot \tan y} - \tan a\right)
double f(double x, double y, double z, double a) {
        double r33122707 = x;
        double r33122708 = y;
        double r33122709 = z;
        double r33122710 = r33122708 + r33122709;
        double r33122711 = tan(r33122710);
        double r33122712 = a;
        double r33122713 = tan(r33122712);
        double r33122714 = r33122711 - r33122713;
        double r33122715 = r33122707 + r33122714;
        return r33122715;
}

double f(double x, double y, double z, double a) {
        double r33122716 = x;
        double r33122717 = y;
        double r33122718 = cos(r33122717);
        double r33122719 = z;
        double r33122720 = sin(r33122719);
        double r33122721 = sin(r33122717);
        double r33122722 = cos(r33122719);
        double r33122723 = r33122721 * r33122722;
        double r33122724 = fma(r33122718, r33122720, r33122723);
        double r33122725 = r33122724 / r33122722;
        double r33122726 = r33122725 / r33122718;
        double r33122727 = 1.0;
        double r33122728 = tan(r33122719);
        double r33122729 = tan(r33122717);
        double r33122730 = r33122728 * r33122729;
        double r33122731 = r33122727 - r33122730;
        double r33122732 = r33122726 / r33122731;
        double r33122733 = a;
        double r33122734 = tan(r33122733);
        double r33122735 = r33122732 - r33122734;
        double r33122736 = r33122716 + r33122735;
        return r33122736;
}

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 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. Simplified0.2

    \[\leadsto x + \left(\frac{\frac{\color{blue}{\mathsf{fma}\left(\left(\sin z\right), \left(\cos y\right), \left(\cos z \cdot \sin y\right)\right)}}{\cos y \cdot \cos z}}{1 - \tan y \cdot \tan z} - \tan a\right)\]
  9. Taylor expanded around -inf 0.2

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

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

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

Reproduce

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