Average Error: 12.8 → 0.3
Time: 1.1m
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)\]
\[\left(\frac{\mathsf{fma}\left(\sqrt[3]{\tan y} \cdot \sqrt[3]{\tan y}, \sqrt[3]{\sqrt[3]{\tan y} \cdot \sqrt[3]{\tan y}} \cdot \sqrt[3]{\sqrt[3]{\tan y}}, \tan z\right)}{1 - \tan y \cdot \tan z} - \tan a\right) + x\]
x + \left(\tan \left(y + z\right) - \tan a\right)
\left(\frac{\mathsf{fma}\left(\sqrt[3]{\tan y} \cdot \sqrt[3]{\tan y}, \sqrt[3]{\sqrt[3]{\tan y} \cdot \sqrt[3]{\tan y}} \cdot \sqrt[3]{\sqrt[3]{\tan y}}, \tan z\right)}{1 - \tan y \cdot \tan z} - \tan a\right) + x
double f(double x, double y, double z, double a) {
        double r4503832 = x;
        double r4503833 = y;
        double r4503834 = z;
        double r4503835 = r4503833 + r4503834;
        double r4503836 = tan(r4503835);
        double r4503837 = a;
        double r4503838 = tan(r4503837);
        double r4503839 = r4503836 - r4503838;
        double r4503840 = r4503832 + r4503839;
        return r4503840;
}

double f(double x, double y, double z, double a) {
        double r4503841 = y;
        double r4503842 = tan(r4503841);
        double r4503843 = cbrt(r4503842);
        double r4503844 = r4503843 * r4503843;
        double r4503845 = cbrt(r4503844);
        double r4503846 = cbrt(r4503843);
        double r4503847 = r4503845 * r4503846;
        double r4503848 = z;
        double r4503849 = tan(r4503848);
        double r4503850 = fma(r4503844, r4503847, r4503849);
        double r4503851 = 1.0;
        double r4503852 = r4503842 * r4503849;
        double r4503853 = r4503851 - r4503852;
        double r4503854 = r4503850 / r4503853;
        double r4503855 = a;
        double r4503856 = tan(r4503855);
        double r4503857 = r4503854 - r4503856;
        double r4503858 = x;
        double r4503859 = r4503857 + r4503858;
        return r4503859;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus a

Derivation

  1. Initial program 12.8

    \[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{\color{blue}{\left(\sqrt[3]{\tan y} \cdot \sqrt[3]{\tan y}\right) \cdot \sqrt[3]{\tan y}} + \tan z}{1 - \tan y \cdot \tan z} - \tan a\right)\]
  6. Applied fma-def0.3

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

    \[\leadsto x + \left(\frac{\mathsf{fma}\left(\sqrt[3]{\tan y} \cdot \sqrt[3]{\tan y}, \sqrt[3]{\color{blue}{\left(\sqrt[3]{\tan y} \cdot \sqrt[3]{\tan y}\right) \cdot \sqrt[3]{\tan y}}}, \tan z\right)}{1 - \tan y \cdot \tan z} - \tan a\right)\]
  9. Applied cbrt-prod0.3

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

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

Reproduce

herbie shell --seed 2019168 +o rules:numerics
(FPCore (x y z a)
  :name "(+ x (- (tan (+ y z)) (tan a)))"
  :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))))