Average Error: 0.3 → 0.4
Time: 4.8s
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 r9428 = 1.0;
        double r9429 = x;
        double r9430 = tan(r9429);
        double r9431 = r9430 * r9430;
        double r9432 = r9428 - r9431;
        double r9433 = r9428 + r9431;
        double r9434 = r9432 / r9433;
        return r9434;
}

double f(double x) {
        double r9435 = 1.0;
        double r9436 = x;
        double r9437 = tan(r9436);
        double r9438 = r9437 * r9437;
        double r9439 = r9435 - r9438;
        double r9440 = r9435 + r9438;
        double r9441 = r9439 / r9440;
        double r9442 = exp(r9441);
        double r9443 = log(r9442);
        return r9443;
}

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 2020039 +o rules:numerics
(FPCore (x)
  :name "Trigonometry B"
  :precision binary64
  (/ (- 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x)))))