Average Error: 0.3 → 0.4
Time: 2.1m
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{\log \left(e^{1 + \tan x}\right) \cdot \left(1 - \tan x\right)}{1 + \tan x \cdot \tan x}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{\log \left(e^{1 + \tan x}\right) \cdot \left(1 - \tan x\right)}{1 + \tan x \cdot \tan x}
double f(double x) {
        double r3503851 = 1.0;
        double r3503852 = x;
        double r3503853 = tan(r3503852);
        double r3503854 = r3503853 * r3503853;
        double r3503855 = r3503851 - r3503854;
        double r3503856 = r3503851 + r3503854;
        double r3503857 = r3503855 / r3503856;
        return r3503857;
}

double f(double x) {
        double r3503858 = 1.0;
        double r3503859 = x;
        double r3503860 = tan(r3503859);
        double r3503861 = r3503858 + r3503860;
        double r3503862 = exp(r3503861);
        double r3503863 = log(r3503862);
        double r3503864 = r3503858 - r3503860;
        double r3503865 = r3503863 * r3503864;
        double r3503866 = r3503860 * r3503860;
        double r3503867 = r3503858 + r3503866;
        double r3503868 = r3503865 / r3503867;
        return r3503868;
}

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 *-un-lft-identity0.3

    \[\leadsto \frac{\color{blue}{1 \cdot 1} - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
  4. Applied difference-of-squares0.4

    \[\leadsto \frac{\color{blue}{\left(1 + \tan x\right) \cdot \left(1 - \tan x\right)}}{1 + \tan x \cdot \tan x}\]
  5. Using strategy rm
  6. Applied add-log-exp0.4

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

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

Reproduce

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