Average Error: 0.3 → 0.4
Time: 1.6m
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}{\tan x \cdot \tan x + 1}}\right)\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\log \left(e^{\frac{1 - \tan x \cdot \tan x}{\tan x \cdot \tan x + 1}}\right)
double f(double x) {
        double r4153781 = 1.0;
        double r4153782 = x;
        double r4153783 = tan(r4153782);
        double r4153784 = r4153783 * r4153783;
        double r4153785 = r4153781 - r4153784;
        double r4153786 = r4153781 + r4153784;
        double r4153787 = r4153785 / r4153786;
        return r4153787;
}

double f(double x) {
        double r4153788 = 1.0;
        double r4153789 = x;
        double r4153790 = tan(r4153789);
        double r4153791 = r4153790 * r4153790;
        double r4153792 = r4153788 - r4153791;
        double r4153793 = r4153791 + r4153788;
        double r4153794 = r4153792 / r4153793;
        double r4153795 = exp(r4153794);
        double r4153796 = log(r4153795);
        return r4153796;
}

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}{\tan x \cdot \tan x + 1}}\right)\]

Reproduce

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