Average Error: 0.3 → 0.4
Time: 1.1min
Precision: binary64
Cost: 26368
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{\left(\tan x + 1\right) \cdot \left(1 - \tan x\right)}{1 + {\tan x}^{2}}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{\left(\tan x + 1\right) \cdot \left(1 - \tan x\right)}{1 + {\tan x}^{2}}
(FPCore (x)
 :precision binary64
 (/ (- 1.0 (* (tan x) (tan x))) (+ 1.0 (* (tan x) (tan x)))))
(FPCore (x)
 :precision binary64
 (/ (* (+ (tan x) 1.0) (- 1.0 (tan x))) (+ 1.0 (pow (tan x) 2.0))))
double code(double x) {
	return (1.0 - (tan(x) * tan(x))) / (1.0 + (tan(x) * tan(x)));
}
double code(double x) {
	return ((tan(x) + 1.0) * (1.0 - tan(x))) / (1.0 + pow(tan(x), 2.0));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Alternatives

Alternative 1
Error0.3
Cost26176
\[\frac{1 - {\tan x}^{2}}{1 + {\tan x}^{2}}\]
Alternative 2
Error25.9
Cost13056
\[1 - {\tan x}^{2}\]
Alternative 3
Error28.7
Cost64
\[1\]

Error

Time

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-sqr-sqrt_binary64_1000.3

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

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

    \[\leadsto \frac{\color{blue}{\left(\tan x + 1\right)} \cdot \left(\sqrt{1} - \tan x\right)}{1 + \tan x \cdot \tan x}\]
  6. Simplified0.4

    \[\leadsto \frac{\left(\tan x + 1\right) \cdot \color{blue}{\left(1 - \tan x\right)}}{1 + \tan x \cdot \tan x}\]
  7. Using strategy rm
  8. Applied pow2_binary64_1590.4

    \[\leadsto \frac{\left(\tan x + 1\right) \cdot \left(1 - \tan x\right)}{1 + \color{blue}{{\tan x}^{2}}}\]
  9. Using strategy rm
  10. Applied pow1_binary64_1390.4

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

    \[\leadsto \frac{\color{blue}{{\left(\tan x + 1\right)}^{1}} \cdot {\left(1 - \tan x\right)}^{1}}{1 + {\tan x}^{2}}\]
  12. Applied pow-prod-down_binary64_1490.4

    \[\leadsto \frac{\color{blue}{{\left(\left(\tan x + 1\right) \cdot \left(1 - \tan x\right)\right)}^{1}}}{1 + {\tan x}^{2}}\]
  13. Simplified0.4

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

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

Reproduce

herbie shell --seed 2021040 
(FPCore (x)
  :name "Trigonometry B"
  :precision binary64
  (/ (- 1.0 (* (tan x) (tan x))) (+ 1.0 (* (tan x) (tan x)))))