Average Error: 13.5 → 0.3
Time: 13.5s
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 r223223 = x;
        double r223224 = y;
        double r223225 = z;
        double r223226 = r223224 + r223225;
        double r223227 = tan(r223226);
        double r223228 = a;
        double r223229 = tan(r223228);
        double r223230 = r223227 - r223229;
        double r223231 = r223223 + r223230;
        return r223231;
}

double f(double x, double y, double z, double a) {
        double r223232 = x;
        double r223233 = y;
        double r223234 = tan(r223233);
        double r223235 = z;
        double r223236 = tan(r223235);
        double r223237 = r223234 + r223236;
        double r223238 = 1.0;
        double r223239 = r223234 * r223236;
        double r223240 = r223238 - r223239;
        double r223241 = r223238 / r223240;
        double r223242 = a;
        double r223243 = tan(r223242);
        double r223244 = -r223243;
        double r223245 = fma(r223237, r223241, r223244);
        double r223246 = r223232 + r223245;
        double r223247 = exp(r223246);
        double r223248 = log(r223247);
        return r223248;
}

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))))