Average Error: 0.3 → 0.4
Time: 16.7s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1}{\frac{\tan x \cdot \tan x + 1}{1 - \tan x \cdot \tan x}}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{1}{\frac{\tan x \cdot \tan x + 1}{1 - \tan x \cdot \tan x}}
double f(double x) {
        double r261284 = 1.0;
        double r261285 = x;
        double r261286 = tan(r261285);
        double r261287 = r261286 * r261286;
        double r261288 = r261284 - r261287;
        double r261289 = r261284 + r261287;
        double r261290 = r261288 / r261289;
        return r261290;
}

double f(double x) {
        double r261291 = 1.0;
        double r261292 = x;
        double r261293 = tan(r261292);
        double r261294 = r261293 * r261293;
        double r261295 = r261294 + r261291;
        double r261296 = r261291 - r261294;
        double r261297 = r261295 / r261296;
        double r261298 = r261291 / r261297;
        return r261298;
}

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 clear-num0.4

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

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

Reproduce

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