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

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original59.9
Target0.1
Herbie0.3
\[\begin{array}{l} \mathbf{if}\;\left|x\right| \lt 0.026:\\ \;\;\;\;\frac{x}{3} \cdot \left(1 + \frac{x \cdot x}{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. Taylor expanded around 0 0.3

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

    \[\leadsto \frac{1}{3} \cdot x + \color{blue}{\log \left(e^{\frac{1}{45} \cdot {x}^{3} + \frac{2}{945} \cdot {x}^{5}}\right)}\]
  5. Using strategy rm
  6. Applied add-cube-cbrt0.5

    \[\leadsto \frac{1}{3} \cdot x + \log \left(e^{\color{blue}{\left(\sqrt[3]{\frac{1}{45} \cdot {x}^{3} + \frac{2}{945} \cdot {x}^{5}} \cdot \sqrt[3]{\frac{1}{45} \cdot {x}^{3} + \frac{2}{945} \cdot {x}^{5}}\right) \cdot \sqrt[3]{\frac{1}{45} \cdot {x}^{3} + \frac{2}{945} \cdot {x}^{5}}}}\right)\]
  7. Applied exp-prod0.5

    \[\leadsto \frac{1}{3} \cdot x + \log \color{blue}{\left({\left(e^{\sqrt[3]{\frac{1}{45} \cdot {x}^{3} + \frac{2}{945} \cdot {x}^{5}} \cdot \sqrt[3]{\frac{1}{45} \cdot {x}^{3} + \frac{2}{945} \cdot {x}^{5}}}\right)}^{\left(\sqrt[3]{\frac{1}{45} \cdot {x}^{3} + \frac{2}{945} \cdot {x}^{5}}\right)}\right)}\]
  8. Applied log-pow0.3

    \[\leadsto \frac{1}{3} \cdot x + \color{blue}{\sqrt[3]{\frac{1}{45} \cdot {x}^{3} + \frac{2}{945} \cdot {x}^{5}} \cdot \log \left(e^{\sqrt[3]{\frac{1}{45} \cdot {x}^{3} + \frac{2}{945} \cdot {x}^{5}} \cdot \sqrt[3]{\frac{1}{45} \cdot {x}^{3} + \frac{2}{945} \cdot {x}^{5}}}\right)}\]
  9. Final simplification0.3

    \[\leadsto \log \left(e^{\sqrt[3]{{x}^{5} \cdot \frac{2}{945} + \frac{1}{45} \cdot {x}^{3}} \cdot \sqrt[3]{{x}^{5} \cdot \frac{2}{945} + \frac{1}{45} \cdot {x}^{3}}}\right) \cdot \sqrt[3]{{x}^{5} \cdot \frac{2}{945} + \frac{1}{45} \cdot {x}^{3}} + \frac{1}{3} \cdot x\]

Runtime

Time bar (total: 35.1s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes0.30.30.30.10%
herbie shell --seed 2018351 
(FPCore (x)
  :name "invcot (example 3.9)"
  :pre (and (< -0.026 x) (< x 0.026))

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

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