Average Error: 0.3 → 0.4
Time: 5.2s
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 r9974 = 1.0;
        double r9975 = x;
        double r9976 = tan(r9975);
        double r9977 = r9976 * r9976;
        double r9978 = r9974 - r9977;
        double r9979 = r9974 + r9977;
        double r9980 = r9978 / r9979;
        return r9980;
}

double f(double x) {
        double r9981 = 1.0;
        double r9982 = x;
        double r9983 = tan(r9982);
        double r9984 = 1.0;
        double r9985 = fma(r9983, r9983, r9984);
        double r9986 = r9983 * r9983;
        double r9987 = r9984 - r9986;
        double r9988 = r9985 / r9987;
        double r9989 = r9981 / r9988;
        return r9989;
}

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