Average Error: 0.3 → 0.4
Time: 20.9s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1}{\tan x \cdot \tan x + 1} - \frac{\tan x \cdot \tan x}{\tan x \cdot \tan x + 1}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{1}{\tan x \cdot \tan x + 1} - \frac{\tan x \cdot \tan x}{\tan x \cdot \tan x + 1}
double f(double x) {
        double r719993 = 1.0;
        double r719994 = x;
        double r719995 = tan(r719994);
        double r719996 = r719995 * r719995;
        double r719997 = r719993 - r719996;
        double r719998 = r719993 + r719996;
        double r719999 = r719997 / r719998;
        return r719999;
}

double f(double x) {
        double r720000 = 1.0;
        double r720001 = x;
        double r720002 = tan(r720001);
        double r720003 = r720002 * r720002;
        double r720004 = r720003 + r720000;
        double r720005 = r720000 / r720004;
        double r720006 = r720003 / r720004;
        double r720007 = r720005 - r720006;
        return r720007;
}

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 div-sub0.4

    \[\leadsto \color{blue}{\frac{1}{1 + \tan x \cdot \tan x} - \frac{\tan x \cdot \tan x}{1 + \tan x \cdot \tan x}}\]
  4. Final simplification0.4

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

Reproduce

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