Average Error: 0.3 → 0.4
Time: 5.3s
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 - \frac{\tan x \cdot \sin x}{\cos 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 - \frac{\tan x \cdot \sin x}{\cos x}}}
double f(double x) {
        double r10819 = 1.0;
        double r10820 = x;
        double r10821 = tan(r10820);
        double r10822 = r10821 * r10821;
        double r10823 = r10819 - r10822;
        double r10824 = r10819 + r10822;
        double r10825 = r10823 / r10824;
        return r10825;
}

double f(double x) {
        double r10826 = 1.0;
        double r10827 = x;
        double r10828 = tan(r10827);
        double r10829 = 1.0;
        double r10830 = fma(r10828, r10828, r10829);
        double r10831 = sin(r10827);
        double r10832 = r10828 * r10831;
        double r10833 = cos(r10827);
        double r10834 = r10832 / r10833;
        double r10835 = r10829 - r10834;
        double r10836 = r10830 / r10835;
        double r10837 = r10826 / r10836;
        return r10837;
}

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. Using strategy rm
  6. Applied tan-quot0.4

    \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(\tan x, \tan x, 1\right)}{1 - \tan x \cdot \color{blue}{\frac{\sin x}{\cos x}}}}\]
  7. Applied associate-*r/0.4

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

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

Reproduce

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