Average Error: 0.3 → 0.4
Time: 25.9s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{1 - \left(\tan x \cdot \tan x\right) \cdot \left(\tan x \cdot \tan x\right)}{\tan x \cdot \tan x + 1}}{\tan x \cdot \tan x + 1}\right)\right)\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{1 - \left(\tan x \cdot \tan x\right) \cdot \left(\tan x \cdot \tan x\right)}{\tan x \cdot \tan x + 1}}{\tan x \cdot \tan x + 1}\right)\right)
double f(double x) {
        double r525175 = 1.0;
        double r525176 = x;
        double r525177 = tan(r525176);
        double r525178 = r525177 * r525177;
        double r525179 = r525175 - r525178;
        double r525180 = r525175 + r525178;
        double r525181 = r525179 / r525180;
        return r525181;
}

double f(double x) {
        double r525182 = 1.0;
        double r525183 = x;
        double r525184 = tan(r525183);
        double r525185 = r525184 * r525184;
        double r525186 = r525185 * r525185;
        double r525187 = r525182 - r525186;
        double r525188 = r525185 + r525182;
        double r525189 = r525187 / r525188;
        double r525190 = r525189 / r525188;
        double r525191 = log1p(r525190);
        double r525192 = expm1(r525191);
        return r525192;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

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 expm1-log1p-u0.4

    \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\right)\right)}\]
  4. Using strategy rm
  5. Applied flip--0.4

    \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\color{blue}{\frac{1 \cdot 1 - \left(\tan x \cdot \tan x\right) \cdot \left(\tan x \cdot \tan x\right)}{1 + \tan x \cdot \tan x}}}{1 + \tan x \cdot \tan x}\right)\right)\]
  6. Simplified0.4

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

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

Reproduce

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