Average Error: 0.3 → 0.4
Time: 5.3s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1 - \frac{\log \left(e^{\tan x \cdot \sin x}\right)}{\cos x}}{1 + \tan x \cdot \tan x}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{1 - \frac{\log \left(e^{\tan x \cdot \sin x}\right)}{\cos x}}{1 + \tan x \cdot \tan x}
double f(double x) {
        double r11524 = 1.0;
        double r11525 = x;
        double r11526 = tan(r11525);
        double r11527 = r11526 * r11526;
        double r11528 = r11524 - r11527;
        double r11529 = r11524 + r11527;
        double r11530 = r11528 / r11529;
        return r11530;
}

double f(double x) {
        double r11531 = 1.0;
        double r11532 = x;
        double r11533 = tan(r11532);
        double r11534 = sin(r11532);
        double r11535 = r11533 * r11534;
        double r11536 = exp(r11535);
        double r11537 = log(r11536);
        double r11538 = cos(r11532);
        double r11539 = r11537 / r11538;
        double r11540 = r11531 - r11539;
        double r11541 = r11533 * r11533;
        double r11542 = r11531 + r11541;
        double r11543 = r11540 / r11542;
        return r11543;
}

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 tan-quot0.4

    \[\leadsto \frac{1 - \tan x \cdot \color{blue}{\frac{\sin x}{\cos x}}}{1 + \tan x \cdot \tan x}\]
  4. Applied associate-*r/0.4

    \[\leadsto \frac{1 - \color{blue}{\frac{\tan x \cdot \sin x}{\cos x}}}{1 + \tan x \cdot \tan x}\]
  5. Using strategy rm
  6. Applied add-log-exp0.4

    \[\leadsto \frac{1 - \frac{\color{blue}{\log \left(e^{\tan x \cdot \sin x}\right)}}{\cos x}}{1 + \tan x \cdot \tan x}\]
  7. Final simplification0.4

    \[\leadsto \frac{1 - \frac{\log \left(e^{\tan x \cdot \sin x}\right)}{\cos x}}{1 + \tan x \cdot \tan x}\]

Reproduce

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