Average Error: 0.3 → 0.4
Time: 32.2s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1}{\frac{1 + \tan x \cdot \tan x}{1 - \tan x \cdot \tan x}}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{1}{\frac{1 + \tan x \cdot \tan x}{1 - \tan x \cdot \tan x}}
double f(double x) {
        double r20109 = 1.0;
        double r20110 = x;
        double r20111 = tan(r20110);
        double r20112 = r20111 * r20111;
        double r20113 = r20109 - r20112;
        double r20114 = r20109 + r20112;
        double r20115 = r20113 / r20114;
        return r20115;
}

double f(double x) {
        double r20116 = 1.0;
        double r20117 = 1.0;
        double r20118 = x;
        double r20119 = tan(r20118);
        double r20120 = r20119 * r20119;
        double r20121 = r20117 + r20120;
        double r20122 = r20117 - r20120;
        double r20123 = r20121 / r20122;
        double r20124 = r20116 / r20123;
        return r20124;
}

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 clear-num0.4

    \[\leadsto \color{blue}{\frac{1}{\frac{1 + \tan x \cdot \tan x}{1 - \tan x \cdot \tan x}}}\]
  4. Final simplification0.4

    \[\leadsto \frac{1}{\frac{1 + \tan x \cdot \tan x}{1 - \tan x \cdot \tan x}}\]

Reproduce

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