Average Error: 12.9 → 0.2
Time: 35.8s
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)\]
\[\left(\mathsf{fma}\left(\tan z \cdot \tan y, \frac{\tan y + \tan z}{1 - \left(\tan z \cdot \tan y\right) \cdot \left(\tan z \cdot \tan y\right)}, \frac{\tan y + \tan z}{1 - \left(\tan z \cdot \tan y\right) \cdot \left(\tan z \cdot \tan y\right)}\right) - \tan a\right) + x\]
x + \left(\tan \left(y + z\right) - \tan a\right)
\left(\mathsf{fma}\left(\tan z \cdot \tan y, \frac{\tan y + \tan z}{1 - \left(\tan z \cdot \tan y\right) \cdot \left(\tan z \cdot \tan y\right)}, \frac{\tan y + \tan z}{1 - \left(\tan z \cdot \tan y\right) \cdot \left(\tan z \cdot \tan y\right)}\right) - \tan a\right) + x
double f(double x, double y, double z, double a) {
        double r4516230 = x;
        double r4516231 = y;
        double r4516232 = z;
        double r4516233 = r4516231 + r4516232;
        double r4516234 = tan(r4516233);
        double r4516235 = a;
        double r4516236 = tan(r4516235);
        double r4516237 = r4516234 - r4516236;
        double r4516238 = r4516230 + r4516237;
        return r4516238;
}

double f(double x, double y, double z, double a) {
        double r4516239 = z;
        double r4516240 = tan(r4516239);
        double r4516241 = y;
        double r4516242 = tan(r4516241);
        double r4516243 = r4516240 * r4516242;
        double r4516244 = r4516242 + r4516240;
        double r4516245 = 1.0;
        double r4516246 = r4516243 * r4516243;
        double r4516247 = r4516245 - r4516246;
        double r4516248 = r4516244 / r4516247;
        double r4516249 = fma(r4516243, r4516248, r4516248);
        double r4516250 = a;
        double r4516251 = tan(r4516250);
        double r4516252 = r4516249 - r4516251;
        double r4516253 = x;
        double r4516254 = r4516252 + r4516253;
        return r4516254;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus a

Derivation

  1. Initial program 12.9

    \[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 add-cube-cbrt0.3

    \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - \color{blue}{\left(\sqrt[3]{\tan a} \cdot \sqrt[3]{\tan a}\right) \cdot \sqrt[3]{\tan a}}\right)\]
  6. Applied flip--0.3

    \[\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}}} - \left(\sqrt[3]{\tan a} \cdot \sqrt[3]{\tan a}\right) \cdot \sqrt[3]{\tan a}\right)\]
  7. Applied associate-/r/0.3

    \[\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)} - \left(\sqrt[3]{\tan a} \cdot \sqrt[3]{\tan a}\right) \cdot \sqrt[3]{\tan a}\right)\]
  8. Applied prod-diff0.3

    \[\leadsto x + \color{blue}{\left(\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, -\sqrt[3]{\tan a} \cdot \left(\sqrt[3]{\tan a} \cdot \sqrt[3]{\tan a}\right)\right) + \mathsf{fma}\left(-\sqrt[3]{\tan a}, \sqrt[3]{\tan a} \cdot \sqrt[3]{\tan a}, \sqrt[3]{\tan a} \cdot \left(\sqrt[3]{\tan a} \cdot \sqrt[3]{\tan a}\right)\right)\right)}\]
  9. Simplified0.2

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

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

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

Reproduce

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