Average Error: 13.2 → 0.2
Time: 35.1s
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)\]
\[x + \frac{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\tan z, \tan y, -1\right), \sin a, \cos a \cdot \left(\frac{\sin z}{\cos z} + \frac{\sin y}{\cos y}\right)\right)}{1 - \tan y \cdot \tan z}}{\cos a}\]
x + \left(\tan \left(y + z\right) - \tan a\right)
x + \frac{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\tan z, \tan y, -1\right), \sin a, \cos a \cdot \left(\frac{\sin z}{\cos z} + \frac{\sin y}{\cos y}\right)\right)}{1 - \tan y \cdot \tan z}}{\cos a}
double f(double x, double y, double z, double a) {
        double r142456 = x;
        double r142457 = y;
        double r142458 = z;
        double r142459 = r142457 + r142458;
        double r142460 = tan(r142459);
        double r142461 = a;
        double r142462 = tan(r142461);
        double r142463 = r142460 - r142462;
        double r142464 = r142456 + r142463;
        return r142464;
}

double f(double x, double y, double z, double a) {
        double r142465 = x;
        double r142466 = z;
        double r142467 = tan(r142466);
        double r142468 = y;
        double r142469 = tan(r142468);
        double r142470 = -1.0;
        double r142471 = fma(r142467, r142469, r142470);
        double r142472 = a;
        double r142473 = sin(r142472);
        double r142474 = cos(r142472);
        double r142475 = sin(r142466);
        double r142476 = cos(r142466);
        double r142477 = r142475 / r142476;
        double r142478 = sin(r142468);
        double r142479 = cos(r142468);
        double r142480 = r142478 / r142479;
        double r142481 = r142477 + r142480;
        double r142482 = r142474 * r142481;
        double r142483 = fma(r142471, r142473, r142482);
        double r142484 = 1.0;
        double r142485 = r142469 * r142467;
        double r142486 = r142484 - r142485;
        double r142487 = r142483 / r142486;
        double r142488 = r142487 / r142474;
        double r142489 = r142465 + r142488;
        return r142489;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus a

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

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

    \[\leadsto x + \frac{\mathsf{fma}\left(\tan z \cdot \tan y + -1, \sin a, \color{blue}{\cos a \cdot \left(\frac{\sin z}{\cos z} + \frac{\sin y}{\cos y}\right)}\right)}{\left(1 - \tan y \cdot \tan z\right) \cdot \cos a}\]
  8. Using strategy rm
  9. Applied associate-/r*0.2

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

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

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

Reproduce

herbie shell --seed 2019322 +o rules:numerics
(FPCore (x y z a)
  :name "(+ x (- (tan (+ y z)) (tan a)))"
  :precision binary64
  :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))))