Average Error: 0.3 → 0.4
Time: 6.1s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1}{\frac{\mathsf{fma}\left(\tan x, \tan x, 1\right)}{1 - \tan x \cdot \tan x}}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{1}{\frac{\mathsf{fma}\left(\tan x, \tan x, 1\right)}{1 - \tan x \cdot \tan x}}
double f(double x) {
        double r14264 = 1.0;
        double r14265 = x;
        double r14266 = tan(r14265);
        double r14267 = r14266 * r14266;
        double r14268 = r14264 - r14267;
        double r14269 = r14264 + r14267;
        double r14270 = r14268 / r14269;
        return r14270;
}

double f(double x) {
        double r14271 = 1.0;
        double r14272 = x;
        double r14273 = tan(r14272);
        double r14274 = 1.0;
        double r14275 = fma(r14273, r14273, r14274);
        double r14276 = r14273 * r14273;
        double r14277 = r14274 - r14276;
        double r14278 = r14275 / r14277;
        double r14279 = r14271 / r14278;
        return r14279;
}

Error

Bits error versus x

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. Simplified0.4

    \[\leadsto \frac{1}{\color{blue}{\frac{\mathsf{fma}\left(\tan x, \tan x, 1\right)}{1 - \tan x \cdot \tan x}}}\]
  5. Final simplification0.4

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

Reproduce

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