Average Error: 13.5 → 0.3
Time: 14.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.751224000000000127647232028319723370461 \cdot 10^{308}\right) \land \left(-1.776707000000000200843839711454021982841 \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.751224000000000127647232028319723370461 \cdot 10^{308}\right)\]
\[x + \left(\tan \left(y + z\right) - \tan a\right)\]
\[\log \left(e^{x + \mathsf{fma}\left(\tan y + \tan z, \frac{1}{1 - \tan y \cdot \tan z}, -\tan a\right)}\right)\]
x + \left(\tan \left(y + z\right) - \tan a\right)
\log \left(e^{x + \mathsf{fma}\left(\tan y + \tan z, \frac{1}{1 - \tan y \cdot \tan z}, -\tan a\right)}\right)
double f(double x, double y, double z, double a) {
        double r189150 = x;
        double r189151 = y;
        double r189152 = z;
        double r189153 = r189151 + r189152;
        double r189154 = tan(r189153);
        double r189155 = a;
        double r189156 = tan(r189155);
        double r189157 = r189154 - r189156;
        double r189158 = r189150 + r189157;
        return r189158;
}

double f(double x, double y, double z, double a) {
        double r189159 = x;
        double r189160 = y;
        double r189161 = tan(r189160);
        double r189162 = z;
        double r189163 = tan(r189162);
        double r189164 = r189161 + r189163;
        double r189165 = 1.0;
        double r189166 = r189161 * r189163;
        double r189167 = r189165 - r189166;
        double r189168 = r189165 / r189167;
        double r189169 = a;
        double r189170 = tan(r189169);
        double r189171 = -r189170;
        double r189172 = fma(r189164, r189168, r189171);
        double r189173 = r189159 + r189172;
        double r189174 = exp(r189173);
        double r189175 = log(r189174);
        return r189175;
}

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 add-log-exp0.2

    \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - \color{blue}{\log \left(e^{\tan a}\right)}\right)\]
  6. Applied add-log-exp0.3

    \[\leadsto x + \left(\color{blue}{\log \left(e^{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}}\right)} - \log \left(e^{\tan a}\right)\right)\]
  7. Applied diff-log0.3

    \[\leadsto x + \color{blue}{\log \left(\frac{e^{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}}}{e^{\tan a}}\right)}\]
  8. Applied add-log-exp0.3

    \[\leadsto \color{blue}{\log \left(e^{x}\right)} + \log \left(\frac{e^{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}}}{e^{\tan a}}\right)\]
  9. Applied sum-log0.3

    \[\leadsto \color{blue}{\log \left(e^{x} \cdot \frac{e^{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}}}{e^{\tan a}}\right)}\]
  10. Simplified0.2

    \[\leadsto \log \color{blue}{\left(e^{x + \left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - \tan a\right)}\right)}\]
  11. Using strategy rm
  12. Applied div-inv0.3

    \[\leadsto \log \left(e^{x + \left(\color{blue}{\left(\tan y + \tan z\right) \cdot \frac{1}{1 - \tan y \cdot \tan z}} - \tan a\right)}\right)\]
  13. Applied fma-neg0.3

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

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

Reproduce

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