Average Error: 0.3 → 0.4
Time: 30.7s
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\right)}{1 + \tan x \cdot \tan x}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{\left(1 + \tan x\right) \cdot \left(1 - \tan x\right)}{1 + \tan x \cdot \tan x}
double f(double x) {
        double r339233 = 1.0;
        double r339234 = x;
        double r339235 = tan(r339234);
        double r339236 = r339235 * r339235;
        double r339237 = r339233 - r339236;
        double r339238 = r339233 + r339236;
        double r339239 = r339237 / r339238;
        return r339239;
}

double f(double x) {
        double r339240 = 1.0;
        double r339241 = x;
        double r339242 = tan(r339241);
        double r339243 = r339240 + r339242;
        double r339244 = r339240 - r339242;
        double r339245 = r339243 * r339244;
        double r339246 = r339242 * r339242;
        double r339247 = r339240 + r339246;
        double r339248 = r339245 / r339247;
        return r339248;
}

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. Final simplification0.4

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

Reproduce

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