Average Error: 13.1 → 0.3
Time: 57.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)\]
\[\left(\left(\frac{\sin y}{\cos y \cdot \left(1 - \frac{\sin y \cdot \sin z}{\cos y \cdot \cos z}\right)} + x\right) + \frac{\sin z}{\cos z \cdot \left(1 - \frac{\sin y \cdot \sin z}{\cos y \cdot \cos z}\right)}\right) - \frac{\sin a}{\cos a}\]
x + \left(\tan \left(y + z\right) - \tan a\right)
\left(\left(\frac{\sin y}{\cos y \cdot \left(1 - \frac{\sin y \cdot \sin z}{\cos y \cdot \cos z}\right)} + x\right) + \frac{\sin z}{\cos z \cdot \left(1 - \frac{\sin y \cdot \sin z}{\cos y \cdot \cos z}\right)}\right) - \frac{\sin a}{\cos a}
double f(double x, double y, double z, double a) {
        double r5381652 = x;
        double r5381653 = y;
        double r5381654 = z;
        double r5381655 = r5381653 + r5381654;
        double r5381656 = tan(r5381655);
        double r5381657 = a;
        double r5381658 = tan(r5381657);
        double r5381659 = r5381656 - r5381658;
        double r5381660 = r5381652 + r5381659;
        return r5381660;
}

double f(double x, double y, double z, double a) {
        double r5381661 = y;
        double r5381662 = sin(r5381661);
        double r5381663 = cos(r5381661);
        double r5381664 = 1.0;
        double r5381665 = z;
        double r5381666 = sin(r5381665);
        double r5381667 = r5381662 * r5381666;
        double r5381668 = cos(r5381665);
        double r5381669 = r5381663 * r5381668;
        double r5381670 = r5381667 / r5381669;
        double r5381671 = r5381664 - r5381670;
        double r5381672 = r5381663 * r5381671;
        double r5381673 = r5381662 / r5381672;
        double r5381674 = x;
        double r5381675 = r5381673 + r5381674;
        double r5381676 = r5381668 * r5381671;
        double r5381677 = r5381666 / r5381676;
        double r5381678 = r5381675 + r5381677;
        double r5381679 = a;
        double r5381680 = sin(r5381679);
        double r5381681 = cos(r5381679);
        double r5381682 = r5381680 / r5381681;
        double r5381683 = r5381678 - r5381682;
        return r5381683;
}

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.1

    \[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 flip3-+0.6

    \[\leadsto \color{blue}{\frac{{x}^{3} + {\left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - \tan a\right)}^{3}}{x \cdot x + \left(\left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - \tan a\right) \cdot \left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - \tan a\right) - x \cdot \left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - \tan a\right)\right)}}\]
  6. Simplified0.5

    \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x, x \cdot x, \left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - \tan a\right) \cdot \left(\left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - \tan a\right) \cdot \left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - \tan a\right)\right)\right)}}{x \cdot x + \left(\left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - \tan a\right) \cdot \left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - \tan a\right) - x \cdot \left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - \tan a\right)\right)}\]
  7. Taylor expanded around inf 0.3

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

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

Reproduce

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