Average Error: 13.0 → 0.2
Time: 1.4m
Precision: 64
\[\left(x = 0 \lor 0.5884142 \le x \le 505.5909\right) \land \left(-1.796658 \cdot 10^{+308} \le y \le -9.425585 \cdot 10^{-310} \lor 1.284938 \cdot 10^{-309} \le y \le 1.751224 \cdot 10^{+308}\right) \land \left(-1.776707 \cdot 10^{+308} \le z \le -8.599796 \cdot 10^{-310} \lor 3.293145 \cdot 10^{-311} \le z \le 1.725154 \cdot 10^{+308}\right) \land \left(-1.796658 \cdot 10^{+308} \le a \le -9.425585 \cdot 10^{-310} \lor 1.284938 \cdot 10^{-309} \le a \le 1.751224 \cdot 10^{+308}\right)\]
\[x + \left(\tan \left(y + z\right) - \tan a\right)\]
\[x + \frac{\cos a \cdot \left(\tan y + \tan z\right) - \sin a \cdot \left(1 - \frac{\tan z \cdot \sin y}{\cos y}\right)}{\left(1 - \tan z \cdot \tan y\right) \cdot \cos a}\]
x + \left(\tan \left(y + z\right) - \tan a\right)
x + \frac{\cos a \cdot \left(\tan y + \tan z\right) - \sin a \cdot \left(1 - \frac{\tan z \cdot \sin y}{\cos y}\right)}{\left(1 - \tan z \cdot \tan y\right) \cdot \cos a}
double f(double x, double y, double z, double a) {
        double r28592016 = x;
        double r28592017 = y;
        double r28592018 = z;
        double r28592019 = r28592017 + r28592018;
        double r28592020 = tan(r28592019);
        double r28592021 = a;
        double r28592022 = tan(r28592021);
        double r28592023 = r28592020 - r28592022;
        double r28592024 = r28592016 + r28592023;
        return r28592024;
}

double f(double x, double y, double z, double a) {
        double r28592025 = x;
        double r28592026 = a;
        double r28592027 = cos(r28592026);
        double r28592028 = y;
        double r28592029 = tan(r28592028);
        double r28592030 = z;
        double r28592031 = tan(r28592030);
        double r28592032 = r28592029 + r28592031;
        double r28592033 = r28592027 * r28592032;
        double r28592034 = sin(r28592026);
        double r28592035 = 1.0;
        double r28592036 = sin(r28592028);
        double r28592037 = r28592031 * r28592036;
        double r28592038 = cos(r28592028);
        double r28592039 = r28592037 / r28592038;
        double r28592040 = r28592035 - r28592039;
        double r28592041 = r28592034 * r28592040;
        double r28592042 = r28592033 - r28592041;
        double r28592043 = r28592031 * r28592029;
        double r28592044 = r28592035 - r28592043;
        double r28592045 = r28592044 * r28592027;
        double r28592046 = r28592042 / r28592045;
        double r28592047 = r28592025 + r28592046;
        return r28592047;
}

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

    \[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 tan-quot0.2

    \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - \color{blue}{\frac{\sin a}{\cos a}}\right)\]
  6. 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}}\]
  7. Using strategy rm
  8. Applied tan-quot0.2

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

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

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

Reproduce

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