Average Error: 58.0 → 0.0
Time: 34.5s
Precision: 64
Internal Precision: 1408
\[\frac{e^{x} - e^{-x}}{e^{x} + e^{-x}}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.010627694727607178:\\ \;\;\;\;\left(\sqrt[3]{\tanh x} \cdot \sqrt[3]{\tanh x}\right) \cdot \sqrt[3]{\tanh x}\\ \mathbf{if}\;x \le 0.00010283471114833369:\\ \;\;\;\;\frac{\frac{1}{3} \cdot {x}^{3} + \left(\frac{1}{60} \cdot {x}^{5} + 2 \cdot x\right)}{e^{x} + e^{-x}}\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt[3]{\tanh x} \cdot \sqrt[3]{\tanh x}\right) \cdot \sqrt[3]{\tanh x}\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.010627694727607178 or 0.00010283471114833369 < x

    1. Initial program 32.9

      \[\frac{e^{x} - e^{-x}}{e^{x} + e^{-x}}\]
    2. Using strategy rm
    3. Applied tanh-undef0.1

      \[\leadsto \color{blue}{\tanh x}\]
    4. Using strategy rm
    5. Applied add-cube-cbrt0.5

      \[\leadsto \color{blue}{\left(\sqrt[3]{\tanh x} \cdot \sqrt[3]{\tanh x}\right) \cdot \sqrt[3]{\tanh x}}\]

    if -0.010627694727607178 < x < 0.00010283471114833369

    1. Initial program 59.0

      \[\frac{e^{x} - e^{-x}}{e^{x} + e^{-x}}\]
    2. Taylor expanded around 0 0.0

      \[\leadsto \frac{\color{blue}{\frac{1}{3} \cdot {x}^{3} + \left(\frac{1}{60} \cdot {x}^{5} + 2 \cdot x\right)}}{e^{x} + e^{-x}}\]
  3. Recombined 2 regimes into one program.

Runtime

Time bar (total: 34.5s)Debug logProfile

herbie shell --seed '#(1070578969 3140398606 632207097 462683394 1189254563 964980650)' 
(FPCore (x)
  :name "Hyperbolic tangent"
  (/ (- (exp x) (exp (- x))) (+ (exp x) (exp (- x)))))