Average Error: 14.9 → 0.3
Time: 24.9s
Precision: 64
Internal Precision: 1344
\[\frac{x}{\tanh x} - 1\]
\[\begin{array}{l} \mathbf{if}\;\frac{x}{\tanh x} - 1 \le 4.89080122427896 \cdot 10^{-13}:\\ \;\;\;\;\left(\frac{2}{945} \cdot {x}^{6} + \frac{1}{3} \cdot {x}^{2}\right) - \frac{1}{45} \cdot {x}^{4}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(\sqrt[3]{\tanh x} \cdot \sqrt[3]{\tanh x}\right) \cdot \sqrt[3]{\tanh x}} - 1\\ \end{array}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if (- (/ x (tanh x)) 1) < 4.89080122427896e-13

    1. Initial program 30.0

      \[\frac{x}{\tanh x} - 1\]
    2. Taylor expanded around 0 0.2

      \[\leadsto \color{blue}{\left(\frac{2}{945} \cdot {x}^{6} + \frac{1}{3} \cdot {x}^{2}\right) - \frac{1}{45} \cdot {x}^{4}}\]

    if 4.89080122427896e-13 < (- (/ x (tanh x)) 1)

    1. Initial program 0.4

      \[\frac{x}{\tanh x} - 1\]
    2. Using strategy rm
    3. Applied add-cube-cbrt0.5

      \[\leadsto \frac{x}{\color{blue}{\left(\sqrt[3]{\tanh x} \cdot \sqrt[3]{\tanh x}\right) \cdot \sqrt[3]{\tanh x}}} - 1\]
  3. Recombined 2 regimes into one program.

Runtime

Time bar (total: 24.9s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)' 
(FPCore (x)
  :name "x/tanh(x)-1"
  (- (/ x (tanh x)) 1))