Average Error: 0.3 → 0.4
Time: 4.5s
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 r9078 = 1.0;
        double r9079 = x;
        double r9080 = tan(r9079);
        double r9081 = r9080 * r9080;
        double r9082 = r9078 - r9081;
        double r9083 = r9078 + r9081;
        double r9084 = r9082 / r9083;
        return r9084;
}

double f(double x) {
        double r9085 = 1.0;
        double r9086 = x;
        double r9087 = tan(r9086);
        double r9088 = r9087 * r9087;
        double r9089 = r9085 - r9088;
        double r9090 = r9085 + r9088;
        double r9091 = r9089 / r9090;
        double r9092 = exp(r9091);
        double r9093 = log(r9092);
        return r9093;
}

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