Average Error: 13.3 → 0.2
Time: 41.1s
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{\left(\tan z \cdot \sin y\right) \cdot \left(\tan z \cdot \tan y\right)}{\cos y}}, \tan z \cdot \tan y + 1, -\tan a\right) + x\]
x + \left(\tan \left(y + z\right) - \tan a\right)
\mathsf{fma}\left(\frac{\tan y + \tan z}{1 - \frac{\left(\tan z \cdot \sin y\right) \cdot \left(\tan z \cdot \tan y\right)}{\cos y}}, \tan z \cdot \tan y + 1, -\tan a\right) + x
double f(double x, double y, double z, double a) {
        double r4542516 = x;
        double r4542517 = y;
        double r4542518 = z;
        double r4542519 = r4542517 + r4542518;
        double r4542520 = tan(r4542519);
        double r4542521 = a;
        double r4542522 = tan(r4542521);
        double r4542523 = r4542520 - r4542522;
        double r4542524 = r4542516 + r4542523;
        return r4542524;
}

double f(double x, double y, double z, double a) {
        double r4542525 = y;
        double r4542526 = tan(r4542525);
        double r4542527 = z;
        double r4542528 = tan(r4542527);
        double r4542529 = r4542526 + r4542528;
        double r4542530 = 1.0;
        double r4542531 = sin(r4542525);
        double r4542532 = r4542528 * r4542531;
        double r4542533 = r4542528 * r4542526;
        double r4542534 = r4542532 * r4542533;
        double r4542535 = cos(r4542525);
        double r4542536 = r4542534 / r4542535;
        double r4542537 = r4542530 - r4542536;
        double r4542538 = r4542529 / r4542537;
        double r4542539 = r4542533 + r4542530;
        double r4542540 = a;
        double r4542541 = tan(r4542540);
        double r4542542 = -r4542541;
        double r4542543 = fma(r4542538, r4542539, r4542542);
        double r4542544 = x;
        double r4542545 = r4542543 + r4542544;
        return r4542545;
}

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 flip--0.2

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

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

    \[\leadsto x + \color{blue}{\mathsf{fma}\left(\frac{\tan y + \tan z}{1 \cdot 1 - \left(\tan y \cdot \tan z\right) \cdot \left(\tan y \cdot \tan z\right)}, 1 + \tan y \cdot \tan z, -\tan a\right)}\]
  8. Using strategy rm
  9. Applied tan-quot0.2

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

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

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

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

Reproduce

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