Average Error: 13.3 → 0.2
Time: 11.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.7512240000000001 \cdot 10^{308}\right) \land \left(-1.7767070000000002 \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.7512240000000001 \cdot 10^{308}\right)\]
\[x + \left(\tan \left(y + z\right) - \tan a\right)\]
\[\left(x + \left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - \tan a\right)\right) + \mathsf{fma}\left(-\sqrt[3]{\tan a}, \sqrt[3]{\tan a} \cdot \sqrt[3]{\tan a}, \mathsf{log1p}\left(\mathsf{expm1}\left(\sqrt[3]{\tan a}\right)\right) \cdot \left(\sqrt[3]{\tan a} \cdot \sqrt[3]{\tan a}\right)\right)\]
x + \left(\tan \left(y + z\right) - \tan a\right)
\left(x + \left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - \tan a\right)\right) + \mathsf{fma}\left(-\sqrt[3]{\tan a}, \sqrt[3]{\tan a} \cdot \sqrt[3]{\tan a}, \mathsf{log1p}\left(\mathsf{expm1}\left(\sqrt[3]{\tan a}\right)\right) \cdot \left(\sqrt[3]{\tan a} \cdot \sqrt[3]{\tan a}\right)\right)
double f(double x, double y, double z, double a) {
        double r151716 = x;
        double r151717 = y;
        double r151718 = z;
        double r151719 = r151717 + r151718;
        double r151720 = tan(r151719);
        double r151721 = a;
        double r151722 = tan(r151721);
        double r151723 = r151720 - r151722;
        double r151724 = r151716 + r151723;
        return r151724;
}

double f(double x, double y, double z, double a) {
        double r151725 = x;
        double r151726 = y;
        double r151727 = tan(r151726);
        double r151728 = z;
        double r151729 = tan(r151728);
        double r151730 = r151727 + r151729;
        double r151731 = 1.0;
        double r151732 = r151727 * r151729;
        double r151733 = r151731 - r151732;
        double r151734 = r151730 / r151733;
        double r151735 = a;
        double r151736 = tan(r151735);
        double r151737 = r151734 - r151736;
        double r151738 = r151725 + r151737;
        double r151739 = cbrt(r151736);
        double r151740 = -r151739;
        double r151741 = r151739 * r151739;
        double r151742 = expm1(r151739);
        double r151743 = log1p(r151742);
        double r151744 = r151743 * r151741;
        double r151745 = fma(r151740, r151741, r151744);
        double r151746 = r151738 + r151745;
        return r151746;
}

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 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 add-sqr-sqrt31.7

    \[\leadsto x + \left(\color{blue}{\sqrt{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} \cdot \sqrt{\frac{\tan y + \tan z}{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 prod-diff31.7

    \[\leadsto x + \color{blue}{\left(\mathsf{fma}\left(\sqrt{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}}, \sqrt{\frac{\tan y + \tan z}{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)}\]
  8. Applied associate-+r+31.7

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

    \[\leadsto \color{blue}{\left(x + \left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - \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)\]
  10. Using strategy rm
  11. Applied log1p-expm1-u0.2

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

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

Reproduce

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