Average Error: 0.3 → 0.4
Time: 16.0s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{{\left(\mathsf{fma}\left(-\tan x, \tan x, {\left(\sqrt[3]{1}\right)}^{3}\right)\right)}^{3} + {\left(\tan x \cdot \left(\left(-\tan x\right) + \tan x\right)\right)}^{3}}{\mathsf{fma}\left(\tan x, \tan x, 1\right) \cdot \mathsf{fma}\left(0 \cdot \tan x, 0 \cdot \tan x, \mathsf{fma}\left(-\tan x, \tan x, 1\right) \cdot \mathsf{fma}\left(0, \tan x, \mathsf{fma}\left(-\tan x, \tan x, 1\right)\right)\right)}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{{\left(\mathsf{fma}\left(-\tan x, \tan x, {\left(\sqrt[3]{1}\right)}^{3}\right)\right)}^{3} + {\left(\tan x \cdot \left(\left(-\tan x\right) + \tan x\right)\right)}^{3}}{\mathsf{fma}\left(\tan x, \tan x, 1\right) \cdot \mathsf{fma}\left(0 \cdot \tan x, 0 \cdot \tan x, \mathsf{fma}\left(-\tan x, \tan x, 1\right) \cdot \mathsf{fma}\left(0, \tan x, \mathsf{fma}\left(-\tan x, \tan x, 1\right)\right)\right)}
double f(double x) {
        double r20943 = 1.0;
        double r20944 = x;
        double r20945 = tan(r20944);
        double r20946 = r20945 * r20945;
        double r20947 = r20943 - r20946;
        double r20948 = r20943 + r20946;
        double r20949 = r20947 / r20948;
        return r20949;
}

double f(double x) {
        double r20950 = x;
        double r20951 = tan(r20950);
        double r20952 = -r20951;
        double r20953 = 1.0;
        double r20954 = cbrt(r20953);
        double r20955 = 3.0;
        double r20956 = pow(r20954, r20955);
        double r20957 = fma(r20952, r20951, r20956);
        double r20958 = pow(r20957, r20955);
        double r20959 = r20952 + r20951;
        double r20960 = r20951 * r20959;
        double r20961 = pow(r20960, r20955);
        double r20962 = r20958 + r20961;
        double r20963 = fma(r20951, r20951, r20953);
        double r20964 = 0.0;
        double r20965 = r20964 * r20951;
        double r20966 = fma(r20952, r20951, r20953);
        double r20967 = fma(r20964, r20951, r20966);
        double r20968 = r20966 * r20967;
        double r20969 = fma(r20965, r20965, r20968);
        double r20970 = r20963 * r20969;
        double r20971 = r20962 / r20970;
        return r20971;
}

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

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

    \[\leadsto \frac{\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)}}{1 + \tan x \cdot \tan x}\]
  5. Simplified0.3

    \[\leadsto \frac{\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)}{1 + \tan x \cdot \tan x}\]
  6. Simplified0.3

    \[\leadsto \frac{\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)}}{1 + \tan x \cdot \tan x}\]
  7. Using strategy rm
  8. Applied flip3-+0.4

    \[\leadsto \frac{\color{blue}{\frac{{\left(\mathsf{fma}\left(-\tan x, \tan x, {\left(\sqrt[3]{1}\right)}^{3}\right)\right)}^{3} + {\left(\tan x \cdot \left(\left(-\tan x\right) + \tan x\right)\right)}^{3}}{\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(\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) \cdot \left(\tan x \cdot \left(\left(-\tan x\right) + \tan x\right)\right)\right)}}}{1 + \tan x \cdot \tan x}\]
  9. Applied associate-/l/0.4

    \[\leadsto \color{blue}{\frac{{\left(\mathsf{fma}\left(-\tan x, \tan x, {\left(\sqrt[3]{1}\right)}^{3}\right)\right)}^{3} + {\left(\tan x \cdot \left(\left(-\tan x\right) + \tan x\right)\right)}^{3}}{\left(1 + \tan x \cdot \tan x\right) \cdot \left(\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(\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) \cdot \left(\tan x \cdot \left(\left(-\tan x\right) + \tan x\right)\right)\right)\right)}}\]
  10. Simplified0.4

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

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

Reproduce

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