Average Error: 0.3 → 0.4
Time: 5.0s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1}{1 + \tan x \cdot \tan x} \cdot \left(1 - \tan x \cdot \tan x\right)\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{1}{1 + \tan x \cdot \tan x} \cdot \left(1 - \tan x \cdot \tan x\right)
double f(double x) {
        double r11511 = 1.0;
        double r11512 = x;
        double r11513 = tan(r11512);
        double r11514 = r11513 * r11513;
        double r11515 = r11511 - r11514;
        double r11516 = r11511 + r11514;
        double r11517 = r11515 / r11516;
        return r11517;
}

double f(double x) {
        double r11518 = 1.0;
        double r11519 = 1.0;
        double r11520 = x;
        double r11521 = tan(r11520);
        double r11522 = r11521 * r11521;
        double r11523 = r11519 + r11522;
        double r11524 = r11518 / r11523;
        double r11525 = r11519 - r11522;
        double r11526 = r11524 * r11525;
        return r11526;
}

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 add-log-exp0.4

    \[\leadsto \color{blue}{\log \left(e^{\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}}\right)}\]
  4. Using strategy rm
  5. Applied div-inv0.5

    \[\leadsto \log \left(e^{\color{blue}{\left(1 - \tan x \cdot \tan x\right) \cdot \frac{1}{1 + \tan x \cdot \tan x}}}\right)\]
  6. Applied exp-prod1.1

    \[\leadsto \log \color{blue}{\left({\left(e^{1 - \tan x \cdot \tan x}\right)}^{\left(\frac{1}{1 + \tan x \cdot \tan x}\right)}\right)}\]
  7. Applied log-pow1.0

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

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

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

Reproduce

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