Average Error: 0.3 → 0.4
Time: 24.1s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{\left(1 + \tan x\right) \cdot \left(1 - \tan x \cdot \tan x\right)}{\left(\tan x \cdot \tan x + 1\right) \cdot \left(1 + \tan x\right)}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{\left(1 + \tan x\right) \cdot \left(1 - \tan x \cdot \tan x\right)}{\left(\tan x \cdot \tan x + 1\right) \cdot \left(1 + \tan x\right)}
double f(double x) {
        double r574968 = 1.0;
        double r574969 = x;
        double r574970 = tan(r574969);
        double r574971 = r574970 * r574970;
        double r574972 = r574968 - r574971;
        double r574973 = r574968 + r574971;
        double r574974 = r574972 / r574973;
        return r574974;
}

double f(double x) {
        double r574975 = 1.0;
        double r574976 = x;
        double r574977 = tan(r574976);
        double r574978 = r574975 + r574977;
        double r574979 = r574977 * r574977;
        double r574980 = r574975 - r574979;
        double r574981 = r574978 * r574980;
        double r574982 = r574979 + r574975;
        double r574983 = r574982 * r574978;
        double r574984 = r574981 / r574983;
        return r574984;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.3

    \[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
  2. Using strategy rm
  3. Applied *-un-lft-identity0.3

    \[\leadsto \frac{\color{blue}{1 \cdot 1} - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
  4. Applied difference-of-squares0.4

    \[\leadsto \frac{\color{blue}{\left(1 + \tan x\right) \cdot \left(1 - \tan x\right)}}{1 + \tan x \cdot \tan x}\]
  5. Using strategy rm
  6. Applied flip--0.3

    \[\leadsto \frac{\left(1 + \tan x\right) \cdot \color{blue}{\frac{1 \cdot 1 - \tan x \cdot \tan x}{1 + \tan x}}}{1 + \tan x \cdot \tan x}\]
  7. Applied associate-*r/0.4

    \[\leadsto \frac{\color{blue}{\frac{\left(1 + \tan x\right) \cdot \left(1 \cdot 1 - \tan x \cdot \tan x\right)}{1 + \tan x}}}{1 + \tan x \cdot \tan x}\]
  8. Applied associate-/l/0.4

    \[\leadsto \color{blue}{\frac{\left(1 + \tan x\right) \cdot \left(1 \cdot 1 - \tan x \cdot \tan x\right)}{\left(1 + \tan x \cdot \tan x\right) \cdot \left(1 + \tan x\right)}}\]
  9. Final simplification0.4

    \[\leadsto \frac{\left(1 + \tan x\right) \cdot \left(1 - \tan x \cdot \tan x\right)}{\left(\tan x \cdot \tan x + 1\right) \cdot \left(1 + \tan x\right)}\]

Reproduce

herbie shell --seed 2019162 +o rules:numerics
(FPCore (x)
  :name "Trigonometry B"
  (/ (- 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x)))))