Average Error: 13.2 → 0.2
Time: 29.7s
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 + \left(1 + \left(\tan y \cdot \tan z + \left(\tan y \cdot \tan z\right) \cdot \left(\tan y \cdot \tan z\right)\right)\right) \cdot \frac{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\tan z, \tan y, -1\right), \sin a, \left(\tan y + \tan z\right) \cdot \cos a\right)}{1 - {\left(\tan y \cdot \tan z\right)}^{3}}}{\cos a}\]
x + \left(\tan \left(y + z\right) - \tan a\right)
x + \left(1 + \left(\tan y \cdot \tan z + \left(\tan y \cdot \tan z\right) \cdot \left(\tan y \cdot \tan z\right)\right)\right) \cdot \frac{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\tan z, \tan y, -1\right), \sin a, \left(\tan y + \tan z\right) \cdot \cos a\right)}{1 - {\left(\tan y \cdot \tan z\right)}^{3}}}{\cos a}
double f(double x, double y, double z, double a) {
        double r97374 = x;
        double r97375 = y;
        double r97376 = z;
        double r97377 = r97375 + r97376;
        double r97378 = tan(r97377);
        double r97379 = a;
        double r97380 = tan(r97379);
        double r97381 = r97378 - r97380;
        double r97382 = r97374 + r97381;
        return r97382;
}

double f(double x, double y, double z, double a) {
        double r97383 = x;
        double r97384 = 1.0;
        double r97385 = y;
        double r97386 = tan(r97385);
        double r97387 = z;
        double r97388 = tan(r97387);
        double r97389 = r97386 * r97388;
        double r97390 = r97389 * r97389;
        double r97391 = r97389 + r97390;
        double r97392 = r97384 + r97391;
        double r97393 = -1.0;
        double r97394 = fma(r97388, r97386, r97393);
        double r97395 = a;
        double r97396 = sin(r97395);
        double r97397 = r97386 + r97388;
        double r97398 = cos(r97395);
        double r97399 = r97397 * r97398;
        double r97400 = fma(r97394, r97396, r97399);
        double r97401 = 3.0;
        double r97402 = pow(r97389, r97401);
        double r97403 = r97384 - r97402;
        double r97404 = r97400 / r97403;
        double r97405 = r97404 / r97398;
        double r97406 = r97392 * r97405;
        double r97407 = r97383 + r97406;
        return r97407;
}

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. Using strategy rm
  8. Applied flip3--0.2

    \[\leadsto x + \frac{\mathsf{fma}\left(\tan z \cdot \tan y + -1, \sin a, \left(\tan y + \tan z\right) \cdot \cos a\right)}{\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 \cos a}\]
  9. Applied associate-*l/0.2

    \[\leadsto x + \frac{\mathsf{fma}\left(\tan z \cdot \tan y + -1, \sin a, \left(\tan y + \tan z\right) \cdot \cos a\right)}{\color{blue}{\frac{\left({1}^{3} - {\left(\tan y \cdot \tan z\right)}^{3}\right) \cdot \cos 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)}}}\]
  10. Applied associate-/r/0.2

    \[\leadsto x + \color{blue}{\frac{\mathsf{fma}\left(\tan z \cdot \tan y + -1, \sin a, \left(\tan y + \tan z\right) \cdot \cos a\right)}{\left({1}^{3} - {\left(\tan y \cdot \tan z\right)}^{3}\right) \cdot \cos a} \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)}\]
  11. Simplified0.2

    \[\leadsto x + \color{blue}{\frac{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\tan z, \tan y, -1\right), \sin a, \left(\tan y + \tan z\right) \cdot \cos a\right)}{1 - {\left(\tan y \cdot \tan z\right)}^{3}}}{\cos a}} \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)\]
  12. Final simplification0.2

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

Reproduce

herbie shell --seed 2019303 +o rules:numerics
(FPCore (x y z a)
  :name "(+ x (- (tan (+ y z)) (tan a)))"
  :precision binary64
  :pre (and (or (== x 0.0) (<= 0.588414199999999998 x 505.590899999999976)) (or (<= -1.79665800000000009e308 y -9.425585000000013e-310) (<= 1.284938e-309 y 1.75122399999999993e308)) (or (<= -1.776707e308 z -8.59979600000002e-310) (<= 3.29314499999998e-311 z 1.72515400000000009e308)) (or (<= -1.79665800000000009e308 a -9.425585000000013e-310) (<= 1.284938e-309 a 1.75122399999999993e308)))
  (+ x (- (tan (+ y z)) (tan a))))