Average Error: 13.3 → 0.3
Time: 30.4s
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)\]
\[x + \frac{\mathsf{fma}\left(\tan z \cdot \tan y + -1, \sin a, \left(\tan y + \tan z\right) \cdot \cos a\right)}{\left(1 - \log \left(e^{\tan z \cdot \tan y}\right)\right) \cdot \cos a}\]
x + \left(\tan \left(y + z\right) - \tan a\right)
x + \frac{\mathsf{fma}\left(\tan z \cdot \tan y + -1, \sin a, \left(\tan y + \tan z\right) \cdot \cos a\right)}{\left(1 - \log \left(e^{\tan z \cdot \tan y}\right)\right) \cdot \cos a}
double f(double x, double y, double z, double a) {
        double r114813 = x;
        double r114814 = y;
        double r114815 = z;
        double r114816 = r114814 + r114815;
        double r114817 = tan(r114816);
        double r114818 = a;
        double r114819 = tan(r114818);
        double r114820 = r114817 - r114819;
        double r114821 = r114813 + r114820;
        return r114821;
}

double f(double x, double y, double z, double a) {
        double r114822 = x;
        double r114823 = z;
        double r114824 = tan(r114823);
        double r114825 = y;
        double r114826 = tan(r114825);
        double r114827 = r114824 * r114826;
        double r114828 = -1.0;
        double r114829 = r114827 + r114828;
        double r114830 = a;
        double r114831 = sin(r114830);
        double r114832 = r114826 + r114824;
        double r114833 = cos(r114830);
        double r114834 = r114832 * r114833;
        double r114835 = fma(r114829, r114831, r114834);
        double r114836 = 1.0;
        double r114837 = exp(r114827);
        double r114838 = log(r114837);
        double r114839 = r114836 - r114838;
        double r114840 = r114839 * r114833;
        double r114841 = r114835 / r114840;
        double r114842 = r114822 + r114841;
        return r114842;
}

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-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. Simplified0.2

    \[\leadsto x + \frac{\color{blue}{\mathsf{fma}\left(\tan z \cdot \tan y + -1, \sin a, \left(\tan y + \tan z\right) \cdot \cos a\right)}}{\left(1 - \tan y \cdot \tan z\right) \cdot \cos a}\]
  7. Using strategy rm
  8. Applied add-log-exp0.3

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

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

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

Reproduce

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