Average Error: 0.3 → 0.4
Time: 20.7s
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 r336136 = 1.0;
        double r336137 = x;
        double r336138 = tan(r336137);
        double r336139 = r336138 * r336138;
        double r336140 = r336136 - r336139;
        double r336141 = r336136 + r336139;
        double r336142 = r336140 / r336141;
        return r336142;
}

double f(double x) {
        double r336143 = 1.0;
        double r336144 = x;
        double r336145 = tan(r336144);
        double r336146 = r336145 * r336145;
        double r336147 = r336146 + r336143;
        double r336148 = r336143 / r336147;
        double r336149 = r336146 / r336147;
        double r336150 = r336148 - r336149;
        return r336150;
}

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