Average Error: 0.3 → 1.2
Time: 22.4s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{\log \left(e^{1 - \tan x \cdot \tan x}\right)}{\tan x \cdot \tan x + 1}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{\log \left(e^{1 - \tan x \cdot \tan x}\right)}{\tan x \cdot \tan x + 1}
double f(double x) {
        double r606014 = 1.0;
        double r606015 = x;
        double r606016 = tan(r606015);
        double r606017 = r606016 * r606016;
        double r606018 = r606014 - r606017;
        double r606019 = r606014 + r606017;
        double r606020 = r606018 / r606019;
        return r606020;
}

double f(double x) {
        double r606021 = 1.0;
        double r606022 = x;
        double r606023 = tan(r606022);
        double r606024 = r606023 * r606023;
        double r606025 = r606021 - r606024;
        double r606026 = exp(r606025);
        double r606027 = log(r606026);
        double r606028 = r606024 + r606021;
        double r606029 = r606027 / r606028;
        return r606029;
}

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-exp1.2

    \[\leadsto \frac{1 - \color{blue}{\log \left(e^{\tan x \cdot \tan x}\right)}}{1 + \tan x \cdot \tan x}\]
  4. Applied add-log-exp1.2

    \[\leadsto \frac{\color{blue}{\log \left(e^{1}\right)} - \log \left(e^{\tan x \cdot \tan x}\right)}{1 + \tan x \cdot \tan x}\]
  5. Applied diff-log1.2

    \[\leadsto \frac{\color{blue}{\log \left(\frac{e^{1}}{e^{\tan x \cdot \tan x}}\right)}}{1 + \tan x \cdot \tan x}\]
  6. Simplified1.2

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

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

Reproduce

herbie shell --seed 2019172 +o rules:numerics
(FPCore (x)
  :name "Trigonometry B"
  (/ (- 1.0 (* (tan x) (tan x))) (+ 1.0 (* (tan x) (tan x)))))