Average Error: 0.3 → 0.5
Time: 26.1s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1 - \left(\tan x \cdot \tan x\right) \cdot \left(\tan x \cdot \tan x\right)}{\left(1 + \tan x \cdot \tan x\right) \cdot \left(1 + \tan x \cdot \tan x\right)}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{1 - \left(\tan x \cdot \tan x\right) \cdot \left(\tan x \cdot \tan x\right)}{\left(1 + \tan x \cdot \tan x\right) \cdot \left(1 + \tan x \cdot \tan x\right)}
double f(double x) {
        double r540964 = 1.0;
        double r540965 = x;
        double r540966 = tan(r540965);
        double r540967 = r540966 * r540966;
        double r540968 = r540964 - r540967;
        double r540969 = r540964 + r540967;
        double r540970 = r540968 / r540969;
        return r540970;
}

double f(double x) {
        double r540971 = 1.0;
        double r540972 = x;
        double r540973 = tan(r540972);
        double r540974 = r540973 * r540973;
        double r540975 = r540974 * r540974;
        double r540976 = r540971 - r540975;
        double r540977 = r540971 + r540974;
        double r540978 = r540977 * r540977;
        double r540979 = r540976 / r540978;
        return r540979;
}

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 flip--0.4

    \[\leadsto \frac{\color{blue}{\frac{1 \cdot 1 - \left(\tan x \cdot \tan x\right) \cdot \left(\tan x \cdot \tan x\right)}{1 + \tan x \cdot \tan x}}}{1 + \tan x \cdot \tan x}\]
  4. Applied associate-/l/0.5

    \[\leadsto \color{blue}{\frac{1 \cdot 1 - \left(\tan x \cdot \tan x\right) \cdot \left(\tan x \cdot \tan x\right)}{\left(1 + \tan x \cdot \tan x\right) \cdot \left(1 + \tan x \cdot \tan x\right)}}\]
  5. Final simplification0.5

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

Reproduce

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