Average Error: 13.4 → 0.3
Time: 13.9s
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.751224000000000127647232028319723370461 \cdot 10^{308}\right) \land \left(-1.776707000000000200843839711454021982841 \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.751224000000000127647232028319723370461 \cdot 10^{308}\right)\]
\[x + \left(\tan \left(y + z\right) - \tan a\right)\]
\[x + \frac{\left(\left(\tan y + \tan z\right) \cdot \cos a\right) \cdot \left(\left(\tan y + \tan z\right) \cdot \cos a\right) - \left(\left(1 - \tan y \cdot \tan z\right) \cdot \sin a\right) \cdot \left(\left(1 - \tan y \cdot \tan z\right) \cdot \sin a\right)}{\left(1 - \frac{\sin y \cdot \sin z}{\cos y \cdot \cos z}\right) \cdot \left(\cos a \cdot \mathsf{fma}\left(\tan y + \tan z, \cos a, \left(1 - \tan y \cdot \tan z\right) \cdot \sin a\right)\right)}\]
x + \left(\tan \left(y + z\right) - \tan a\right)
x + \frac{\left(\left(\tan y + \tan z\right) \cdot \cos a\right) \cdot \left(\left(\tan y + \tan z\right) \cdot \cos a\right) - \left(\left(1 - \tan y \cdot \tan z\right) \cdot \sin a\right) \cdot \left(\left(1 - \tan y \cdot \tan z\right) \cdot \sin a\right)}{\left(1 - \frac{\sin y \cdot \sin z}{\cos y \cdot \cos z}\right) \cdot \left(\cos a \cdot \mathsf{fma}\left(\tan y + \tan z, \cos a, \left(1 - \tan y \cdot \tan z\right) \cdot \sin a\right)\right)}
double f(double x, double y, double z, double a) {
        double r244456 = x;
        double r244457 = y;
        double r244458 = z;
        double r244459 = r244457 + r244458;
        double r244460 = tan(r244459);
        double r244461 = a;
        double r244462 = tan(r244461);
        double r244463 = r244460 - r244462;
        double r244464 = r244456 + r244463;
        return r244464;
}

double f(double x, double y, double z, double a) {
        double r244465 = x;
        double r244466 = y;
        double r244467 = tan(r244466);
        double r244468 = z;
        double r244469 = tan(r244468);
        double r244470 = r244467 + r244469;
        double r244471 = a;
        double r244472 = cos(r244471);
        double r244473 = r244470 * r244472;
        double r244474 = r244473 * r244473;
        double r244475 = 1.0;
        double r244476 = r244467 * r244469;
        double r244477 = r244475 - r244476;
        double r244478 = sin(r244471);
        double r244479 = r244477 * r244478;
        double r244480 = r244479 * r244479;
        double r244481 = r244474 - r244480;
        double r244482 = sin(r244466);
        double r244483 = sin(r244468);
        double r244484 = r244482 * r244483;
        double r244485 = cos(r244466);
        double r244486 = cos(r244468);
        double r244487 = r244485 * r244486;
        double r244488 = r244484 / r244487;
        double r244489 = r244475 - r244488;
        double r244490 = fma(r244470, r244472, r244479);
        double r244491 = r244472 * r244490;
        double r244492 = r244489 * r244491;
        double r244493 = r244481 / r244492;
        double r244494 = r244465 + r244493;
        return r244494;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus a

Derivation

  1. Initial program 13.4

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

    \[\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 tan-quot0.2

    \[\leadsto x + \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 \color{blue}{\frac{\sin z}{\cos z}}\right) \cdot \cos a}\]
  8. Applied tan-quot0.2

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

    \[\leadsto x + \frac{\left(\tan y + \tan z\right) \cdot \cos a - \left(1 - \tan y \cdot \tan z\right) \cdot \sin a}{\left(1 - \color{blue}{\frac{\sin y \cdot \sin z}{\cos y \cdot \cos z}}\right) \cdot \cos a}\]
  10. Using strategy rm
  11. Applied flip--0.3

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

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

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

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

Reproduce

herbie shell --seed 2020002 +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.7512240000000001e+308)) (or (<= -1.7767070000000002e+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.7512240000000001e+308)))
  (+ x (- (tan (+ y z)) (tan a))))