Average Error: 0.3 → 0.3
Time: 11.0s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
double f(double x) {
        double r23053 = 1.0;
        double r23054 = x;
        double r23055 = tan(r23054);
        double r23056 = r23055 * r23055;
        double r23057 = r23053 - r23056;
        double r23058 = r23053 + r23056;
        double r23059 = r23057 / r23058;
        return r23059;
}

double f(double x) {
        double r23060 = 1.0;
        double r23061 = x;
        double r23062 = tan(r23061);
        double r23063 = r23062 * r23062;
        double r23064 = r23060 - r23063;
        double r23065 = r23060 + r23063;
        double r23066 = r23064 / r23065;
        return r23066;
}

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{1 - \tan x \cdot \tan x}{\color{blue}{1 \cdot \left(1 + \tan x \cdot \tan x\right)}}\]
  4. Applied add-sqr-sqrt0.3

    \[\leadsto \frac{\color{blue}{\sqrt{1} \cdot \sqrt{1}} - \tan x \cdot \tan x}{1 \cdot \left(1 + \tan x \cdot \tan x\right)}\]
  5. Applied difference-of-squares0.4

    \[\leadsto \frac{\color{blue}{\left(\sqrt{1} + \tan x\right) \cdot \left(\sqrt{1} - \tan x\right)}}{1 \cdot \left(1 + \tan x \cdot \tan x\right)}\]
  6. Applied times-frac0.4

    \[\leadsto \color{blue}{\frac{\sqrt{1} + \tan x}{1} \cdot \frac{\sqrt{1} - \tan x}{1 + \tan x \cdot \tan x}}\]
  7. Simplified0.4

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

    \[\leadsto \frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]

Reproduce

herbie shell --seed 2019308 
(FPCore (x)
  :name "Trigonometry B"
  :precision binary64
  (/ (- 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x)))))