Average Error: 0.3 → 0.4
Time: 17.0s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{\frac{\mathsf{fma}\left(\tan x, 0, \mathsf{fma}\left(-\tan x, \tan x, 1\right)\right) \cdot \mathsf{fma}\left(\tan x, 0, \mathsf{fma}\left(-\tan x, \tan x, 1\right)\right)}{\mathsf{fma}\left(\tan x, \tan x, 1\right)}}{\mathsf{fma}\left(-\tan x, \tan x, {\left(\sqrt[3]{1}\right)}^{3}\right) - \tan x \cdot \left(\left(-\tan x\right) + \tan x\right)}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{\frac{\mathsf{fma}\left(\tan x, 0, \mathsf{fma}\left(-\tan x, \tan x, 1\right)\right) \cdot \mathsf{fma}\left(\tan x, 0, \mathsf{fma}\left(-\tan x, \tan x, 1\right)\right)}{\mathsf{fma}\left(\tan x, \tan x, 1\right)}}{\mathsf{fma}\left(-\tan x, \tan x, {\left(\sqrt[3]{1}\right)}^{3}\right) - \tan x \cdot \left(\left(-\tan x\right) + \tan x\right)}
double f(double x) {
        double r22106 = 1.0;
        double r22107 = x;
        double r22108 = tan(r22107);
        double r22109 = r22108 * r22108;
        double r22110 = r22106 - r22109;
        double r22111 = r22106 + r22109;
        double r22112 = r22110 / r22111;
        return r22112;
}

double f(double x) {
        double r22113 = x;
        double r22114 = tan(r22113);
        double r22115 = 0.0;
        double r22116 = -r22114;
        double r22117 = 1.0;
        double r22118 = fma(r22116, r22114, r22117);
        double r22119 = fma(r22114, r22115, r22118);
        double r22120 = r22119 * r22119;
        double r22121 = fma(r22114, r22114, r22117);
        double r22122 = r22120 / r22121;
        double r22123 = cbrt(r22117);
        double r22124 = 3.0;
        double r22125 = pow(r22123, r22124);
        double r22126 = fma(r22116, r22114, r22125);
        double r22127 = r22116 + r22114;
        double r22128 = r22114 * r22127;
        double r22129 = r22126 - r22128;
        double r22130 = r22122 / r22129;
        return r22130;
}

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 add-cube-cbrt0.4

    \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(\tan x, \tan x, 1\right)}{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}} - \tan x \cdot \tan x}}\]
  7. Applied prod-diff0.4

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

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

    \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(\tan x, \tan x, 1\right)}{\mathsf{fma}\left(-\tan x, \tan x, {\left(\sqrt[3]{1}\right)}^{3}\right) + \color{blue}{\tan x \cdot \left(\left(-\tan x\right) + \tan x\right)}}}\]
  10. Using strategy rm
  11. Applied flip-+0.4

    \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(\tan x, \tan x, 1\right)}{\color{blue}{\frac{\mathsf{fma}\left(-\tan x, \tan x, {\left(\sqrt[3]{1}\right)}^{3}\right) \cdot \mathsf{fma}\left(-\tan x, \tan x, {\left(\sqrt[3]{1}\right)}^{3}\right) - \left(\tan x \cdot \left(\left(-\tan x\right) + \tan x\right)\right) \cdot \left(\tan x \cdot \left(\left(-\tan x\right) + \tan x\right)\right)}{\mathsf{fma}\left(-\tan x, \tan x, {\left(\sqrt[3]{1}\right)}^{3}\right) - \tan x \cdot \left(\left(-\tan x\right) + \tan x\right)}}}}\]
  12. Applied associate-/r/0.4

    \[\leadsto \frac{1}{\color{blue}{\frac{\mathsf{fma}\left(\tan x, \tan x, 1\right)}{\mathsf{fma}\left(-\tan x, \tan x, {\left(\sqrt[3]{1}\right)}^{3}\right) \cdot \mathsf{fma}\left(-\tan x, \tan x, {\left(\sqrt[3]{1}\right)}^{3}\right) - \left(\tan x \cdot \left(\left(-\tan x\right) + \tan x\right)\right) \cdot \left(\tan x \cdot \left(\left(-\tan x\right) + \tan x\right)\right)} \cdot \left(\mathsf{fma}\left(-\tan x, \tan x, {\left(\sqrt[3]{1}\right)}^{3}\right) - \tan x \cdot \left(\left(-\tan x\right) + \tan x\right)\right)}}\]
  13. Applied associate-/r*0.4

    \[\leadsto \color{blue}{\frac{\frac{1}{\frac{\mathsf{fma}\left(\tan x, \tan x, 1\right)}{\mathsf{fma}\left(-\tan x, \tan x, {\left(\sqrt[3]{1}\right)}^{3}\right) \cdot \mathsf{fma}\left(-\tan x, \tan x, {\left(\sqrt[3]{1}\right)}^{3}\right) - \left(\tan x \cdot \left(\left(-\tan x\right) + \tan x\right)\right) \cdot \left(\tan x \cdot \left(\left(-\tan x\right) + \tan x\right)\right)}}}{\mathsf{fma}\left(-\tan x, \tan x, {\left(\sqrt[3]{1}\right)}^{3}\right) - \tan x \cdot \left(\left(-\tan x\right) + \tan x\right)}}\]
  14. Simplified0.4

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

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

Reproduce

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