Average Error: 0.3 → 0.4
Time: 1.3m
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 r667905 = 1.0;
        double r667906 = x;
        double r667907 = tan(r667906);
        double r667908 = r667907 * r667907;
        double r667909 = r667905 - r667908;
        double r667910 = r667905 + r667908;
        double r667911 = r667909 / r667910;
        return r667911;
}

double f(double x) {
        double r667912 = 1.0;
        double r667913 = x;
        double r667914 = tan(r667913);
        double r667915 = r667914 * r667914;
        double r667916 = r667915 + r667912;
        double r667917 = r667912 / r667916;
        double r667918 = r667915 / r667916;
        double r667919 = r667917 - r667918;
        return r667919;
}

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 2019152 +o rules:numerics
(FPCore (x)
  :name "Trigonometry B"
  (/ (- 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x)))))