Average Error: 0.3 → 0.4
Time: 21.8s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\left(1 + \tan x\right) \cdot \frac{1 - \tan x}{\mathsf{fma}\left(\left(\tan x\right), \left(\tan x\right), 1\right)}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\left(1 + \tan x\right) \cdot \frac{1 - \tan x}{\mathsf{fma}\left(\left(\tan x\right), \left(\tan x\right), 1\right)}
double f(double x) {
        double r495913 = 1.0;
        double r495914 = x;
        double r495915 = tan(r495914);
        double r495916 = r495915 * r495915;
        double r495917 = r495913 - r495916;
        double r495918 = r495913 + r495916;
        double r495919 = r495917 / r495918;
        return r495919;
}

double f(double x) {
        double r495920 = 1.0;
        double r495921 = x;
        double r495922 = tan(r495921);
        double r495923 = r495920 + r495922;
        double r495924 = r495920 - r495922;
        double r495925 = fma(r495922, r495922, r495920);
        double r495926 = r495924 / r495925;
        double r495927 = r495923 * r495926;
        return r495927;
}

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 *-un-lft-identity0.3

    \[\leadsto \frac{1 - \tan x \cdot \tan x}{\color{blue}{1 \cdot \left(1 + \tan x \cdot \tan x\right)}}\]
  4. Applied add-sqr-sqrt0.3

    \[\leadsto \frac{\color{blue}{\sqrt{1} \cdot \sqrt{1}} - \tan x \cdot \tan x}{1 \cdot \left(1 + \tan x \cdot \tan x\right)}\]
  5. Applied difference-of-squares0.4

    \[\leadsto \frac{\color{blue}{\left(\sqrt{1} + \tan x\right) \cdot \left(\sqrt{1} - \tan x\right)}}{1 \cdot \left(1 + \tan x \cdot \tan x\right)}\]
  6. Applied times-frac0.4

    \[\leadsto \color{blue}{\frac{\sqrt{1} + \tan x}{1} \cdot \frac{\sqrt{1} - \tan x}{1 + \tan x \cdot \tan x}}\]
  7. Simplified0.4

    \[\leadsto \color{blue}{\left(1 + \tan x\right)} \cdot \frac{\sqrt{1} - \tan x}{1 + \tan x \cdot \tan x}\]
  8. Simplified0.4

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

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

Reproduce

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