Average Error: 13.2 → 0.3
Time: 10.1s
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)\]
\[x + \frac{\left(\tan y + \tan z\right) \cdot \cos a - \left(1 - \tan y \cdot \tan z\right) \cdot \sin a}{\left(1 - \frac{\tan y \cdot \sin z}{\cos z} \cdot \frac{\tan y \cdot \sin z}{\cos z}\right) \cdot \cos a} \cdot \left(1 + \log \left(e^{\frac{\tan y \cdot \sin z}{\cos z}}\right)\right)\]
x + \left(\tan \left(y + z\right) - \tan a\right)
x + \frac{\left(\tan y + \tan z\right) \cdot \cos a - \left(1 - \tan y \cdot \tan z\right) \cdot \sin a}{\left(1 - \frac{\tan y \cdot \sin z}{\cos z} \cdot \frac{\tan y \cdot \sin z}{\cos z}\right) \cdot \cos a} \cdot \left(1 + \log \left(e^{\frac{\tan y \cdot \sin z}{\cos z}}\right)\right)
double f(double x, double y, double z, double a) {
        double r171733 = x;
        double r171734 = y;
        double r171735 = z;
        double r171736 = r171734 + r171735;
        double r171737 = tan(r171736);
        double r171738 = a;
        double r171739 = tan(r171738);
        double r171740 = r171737 - r171739;
        double r171741 = r171733 + r171740;
        return r171741;
}

double f(double x, double y, double z, double a) {
        double r171742 = x;
        double r171743 = y;
        double r171744 = tan(r171743);
        double r171745 = z;
        double r171746 = tan(r171745);
        double r171747 = r171744 + r171746;
        double r171748 = a;
        double r171749 = cos(r171748);
        double r171750 = r171747 * r171749;
        double r171751 = 1.0;
        double r171752 = r171744 * r171746;
        double r171753 = r171751 - r171752;
        double r171754 = sin(r171748);
        double r171755 = r171753 * r171754;
        double r171756 = r171750 - r171755;
        double r171757 = sin(r171745);
        double r171758 = r171744 * r171757;
        double r171759 = cos(r171745);
        double r171760 = r171758 / r171759;
        double r171761 = r171760 * r171760;
        double r171762 = r171751 - r171761;
        double r171763 = r171762 * r171749;
        double r171764 = r171756 / r171763;
        double r171765 = exp(r171760);
        double r171766 = log(r171765);
        double r171767 = r171751 + r171766;
        double r171768 = r171764 * r171767;
        double r171769 = r171742 + r171768;
        return r171769;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus a

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 13.2

    \[x + \left(\tan \left(y + z\right) - \tan a\right)\]
  2. Using strategy rm
  3. Applied tan-quot13.3

    \[\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. Using strategy rm
  7. Applied tan-quot0.2

    \[\leadsto x + \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 \color{blue}{\frac{\sin z}{\cos z}}\right) \cdot \cos a}\]
  8. Applied associate-*r/0.2

    \[\leadsto x + \frac{\left(\tan y + \tan z\right) \cdot \cos a - \left(1 - \tan y \cdot \tan z\right) \cdot \sin a}{\left(1 - \color{blue}{\frac{\tan y \cdot \sin z}{\cos z}}\right) \cdot \cos a}\]
  9. Using strategy rm
  10. Applied flip--0.2

    \[\leadsto x + \frac{\left(\tan y + \tan z\right) \cdot \cos a - \left(1 - \tan y \cdot \tan z\right) \cdot \sin a}{\color{blue}{\frac{1 \cdot 1 - \frac{\tan y \cdot \sin z}{\cos z} \cdot \frac{\tan y \cdot \sin z}{\cos z}}{1 + \frac{\tan y \cdot \sin z}{\cos z}}} \cdot \cos a}\]
  11. Applied associate-*l/0.2

    \[\leadsto x + \frac{\left(\tan y + \tan z\right) \cdot \cos a - \left(1 - \tan y \cdot \tan z\right) \cdot \sin a}{\color{blue}{\frac{\left(1 \cdot 1 - \frac{\tan y \cdot \sin z}{\cos z} \cdot \frac{\tan y \cdot \sin z}{\cos z}\right) \cdot \cos a}{1 + \frac{\tan y \cdot \sin z}{\cos z}}}}\]
  12. Applied associate-/r/0.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 \cdot 1 - \frac{\tan y \cdot \sin z}{\cos z} \cdot \frac{\tan y \cdot \sin z}{\cos z}\right) \cdot \cos a} \cdot \left(1 + \frac{\tan y \cdot \sin z}{\cos z}\right)}\]
  13. Simplified0.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 - \frac{\tan y \cdot \sin z}{\cos z} \cdot \frac{\tan y \cdot \sin z}{\cos z}\right) \cdot \cos a}} \cdot \left(1 + \frac{\tan y \cdot \sin z}{\cos z}\right)\]
  14. Using strategy rm
  15. Applied add-log-exp0.3

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

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

Reproduce

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