Average Error: 13.0 → 0.2
Time: 2.3m
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 + \frac{(\left(\tan y + \tan z\right) \cdot \left((\left(\cos a\right) \cdot \left((\left(\tan z \cdot \tan y\right) \cdot \left(\tan z \cdot \tan y\right) + \left(\tan z \cdot \tan y\right))_*\right) + \left(\cos a\right))_* \cdot \left(\tan y - \tan z\right)\right) + \left(\left(-\sin a \cdot \left(\tan y - \tan z\right)\right) \cdot \left(1 - \left(\left(\tan z \cdot \tan y\right) \cdot \left(\tan z \cdot \tan y\right)\right) \cdot \left(\tan z \cdot \tan y\right)\right)\right))_*}{\left(\cos a \cdot \left(1 - \tan z \cdot \tan y\right)\right) \cdot \left(\left(1 + \left(\left(\tan z \cdot \tan y\right) \cdot \left(\tan z \cdot \tan y\right) + \tan z \cdot \tan y\right)\right) \cdot \left(\tan y - \tan z\right)\right)}\]
x + \left(\tan \left(y + z\right) - \tan a\right)
x + \frac{(\left(\tan y + \tan z\right) \cdot \left((\left(\cos a\right) \cdot \left((\left(\tan z \cdot \tan y\right) \cdot \left(\tan z \cdot \tan y\right) + \left(\tan z \cdot \tan y\right))_*\right) + \left(\cos a\right))_* \cdot \left(\tan y - \tan z\right)\right) + \left(\left(-\sin a \cdot \left(\tan y - \tan z\right)\right) \cdot \left(1 - \left(\left(\tan z \cdot \tan y\right) \cdot \left(\tan z \cdot \tan y\right)\right) \cdot \left(\tan z \cdot \tan y\right)\right)\right))_*}{\left(\cos a \cdot \left(1 - \tan z \cdot \tan y\right)\right) \cdot \left(\left(1 + \left(\left(\tan z \cdot \tan y\right) \cdot \left(\tan z \cdot \tan y\right) + \tan z \cdot \tan y\right)\right) \cdot \left(\tan y - \tan z\right)\right)}
double f(double x, double y, double z, double a) {
        double r49612167 = x;
        double r49612168 = y;
        double r49612169 = z;
        double r49612170 = r49612168 + r49612169;
        double r49612171 = tan(r49612170);
        double r49612172 = a;
        double r49612173 = tan(r49612172);
        double r49612174 = r49612171 - r49612173;
        double r49612175 = r49612167 + r49612174;
        return r49612175;
}

double f(double x, double y, double z, double a) {
        double r49612176 = x;
        double r49612177 = y;
        double r49612178 = tan(r49612177);
        double r49612179 = z;
        double r49612180 = tan(r49612179);
        double r49612181 = r49612178 + r49612180;
        double r49612182 = a;
        double r49612183 = cos(r49612182);
        double r49612184 = r49612180 * r49612178;
        double r49612185 = fma(r49612184, r49612184, r49612184);
        double r49612186 = fma(r49612183, r49612185, r49612183);
        double r49612187 = r49612178 - r49612180;
        double r49612188 = r49612186 * r49612187;
        double r49612189 = sin(r49612182);
        double r49612190 = r49612189 * r49612187;
        double r49612191 = -r49612190;
        double r49612192 = 1.0;
        double r49612193 = r49612184 * r49612184;
        double r49612194 = r49612193 * r49612184;
        double r49612195 = r49612192 - r49612194;
        double r49612196 = r49612191 * r49612195;
        double r49612197 = fma(r49612181, r49612188, r49612196);
        double r49612198 = r49612192 - r49612184;
        double r49612199 = r49612183 * r49612198;
        double r49612200 = r49612193 + r49612184;
        double r49612201 = r49612192 + r49612200;
        double r49612202 = r49612201 * r49612187;
        double r49612203 = r49612199 * r49612202;
        double r49612204 = r49612197 / r49612203;
        double r49612205 = r49612176 + r49612204;
        return r49612205;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus a

Derivation

  1. Initial program 13.0

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

    \[\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 flip3--0.2

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

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

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

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

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

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

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

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

Reproduce

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