Average Error: 0.3 → 0.4
Time: 4.7s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\log \left(e^{\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}}\right)\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\log \left(e^{\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}}\right)
double f(double x) {
        double r8726 = 1.0;
        double r8727 = x;
        double r8728 = tan(r8727);
        double r8729 = r8728 * r8728;
        double r8730 = r8726 - r8729;
        double r8731 = r8726 + r8729;
        double r8732 = r8730 / r8731;
        return r8732;
}

double f(double x) {
        double r8733 = 1.0;
        double r8734 = x;
        double r8735 = tan(r8734);
        double r8736 = r8735 * r8735;
        double r8737 = r8733 - r8736;
        double r8738 = r8733 + r8736;
        double r8739 = r8737 / r8738;
        double r8740 = exp(r8739);
        double r8741 = log(r8740);
        return r8741;
}

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. Final simplification0.4

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

Reproduce

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