Average Error: 59.9 → 0.3
Time: 34.7s
Precision: 64
Ground Truth: 128
\[\frac{1}{x} - \frac{1}{\tan x}\]
\[\frac{2}{945} \cdot {x}^{5} + \left({x}^3 \cdot \frac{1}{45} + x \cdot \frac{1}{3}\right)\]

Error

Bits error versus x

Target

Original59.9
Comparison0.1
Herbie0.3
\[ \begin{array}{l} \mathbf{if}\;\left|x\right| \lt 0.026:\\ \;\;\;\;\frac{x}{3} \cdot \left(1 + \frac{{x}^2}{15}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x} - \frac{1}{\tan x}\\ \end{array} \]

Derivation

  1. Initial program 59.9

    \[\frac{1}{x} - \frac{1}{\tan x}\]
  2. Applied taylor 0.3

    \[\leadsto \frac{2}{945} \cdot {x}^{5} + \left(\frac{1}{45} \cdot {x}^{3} + \frac{1}{3} \cdot x\right)\]
  3. Taylor expanded around 0 0.3

    \[\leadsto \color{blue}{\frac{2}{945} \cdot {x}^{5} + \left(\frac{1}{45} \cdot {x}^{3} + \frac{1}{3} \cdot x\right)}\]
  4. Applied simplify 0.3

    \[\leadsto \color{blue}{\frac{2}{945} \cdot {x}^{5} + \left({x}^3 \cdot \frac{1}{45} + x \cdot \frac{1}{3}\right)}\]
  5. Removed slow pow expressions

Runtime

Total time: 34.7s Debug log

Please include this information when filing a bug report:

herbie --seed '#(333034975 636858068 2692566662 258151427 3801121011 202055425)'
(FPCore (x)
  :name "NMSE example 3.9"
  :pre (and (< -0.026 x) (< x 0.026))

  :target
  (if (< (fabs x) 0.026) (* (/ x 3) (+ 1 (/ (sqr x) 15))) (- (/ 1 x) (/ 1 (tan x))))

  (- (/ 1 x) (/ 1 (tan x))))