Average Error: 13.5 → 0.2
Time: 37.2s
Precision: 64
\[\left(x = 0.0 \lor 0.588414199999999998 \le x \le 505.590899999999976\right) \land \left(-1.79665800000000009 \cdot 10^{308} \le y \le -9.425585000000013 \cdot 10^{-310} \lor 1.284938 \cdot 10^{-309} \le y \le 1.75122399999999993 \cdot 10^{308}\right) \land \left(-1.776707 \cdot 10^{308} \le z \le -8.59979600000002 \cdot 10^{-310} \lor 3.29314499999998 \cdot 10^{-311} \le z \le 1.72515400000000009 \cdot 10^{308}\right) \land \left(-1.79665800000000009 \cdot 10^{308} \le a \le -9.425585000000013 \cdot 10^{-310} \lor 1.284938 \cdot 10^{-309} \le a \le 1.75122399999999993 \cdot 10^{308}\right)\]
\[x + \left(\tan \left(y + z\right) - \tan a\right)\]
\[\left(x + \left(\left(\tan y + \tan z\right) \cdot \frac{1}{1 - \tan y \cdot \tan z} - \tan a\right)\right) + \mathsf{fma}\left(-\tan a, 1, \tan a\right)\]
x + \left(\tan \left(y + z\right) - \tan a\right)
\left(x + \left(\left(\tan y + \tan z\right) \cdot \frac{1}{1 - \tan y \cdot \tan z} - \tan a\right)\right) + \mathsf{fma}\left(-\tan a, 1, \tan a\right)
double f(double x, double y, double z, double a) {
        double r93293 = x;
        double r93294 = y;
        double r93295 = z;
        double r93296 = r93294 + r93295;
        double r93297 = tan(r93296);
        double r93298 = a;
        double r93299 = tan(r93298);
        double r93300 = r93297 - r93299;
        double r93301 = r93293 + r93300;
        return r93301;
}

double f(double x, double y, double z, double a) {
        double r93302 = x;
        double r93303 = y;
        double r93304 = tan(r93303);
        double r93305 = z;
        double r93306 = tan(r93305);
        double r93307 = r93304 + r93306;
        double r93308 = 1.0;
        double r93309 = r93304 * r93306;
        double r93310 = r93308 - r93309;
        double r93311 = r93308 / r93310;
        double r93312 = r93307 * r93311;
        double r93313 = a;
        double r93314 = tan(r93313);
        double r93315 = r93312 - r93314;
        double r93316 = r93302 + r93315;
        double r93317 = -r93314;
        double r93318 = fma(r93317, r93308, r93314);
        double r93319 = r93316 + r93318;
        return r93319;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus a

Derivation

  1. Initial program 13.5

    \[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 *-un-lft-identity0.2

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

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

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

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

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

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

Reproduce

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