Average Error: 58.2 → 1.1
Time: 3.2s
Precision: binary64
\[\]
\[\]

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < 1.90330772110840095e-6

    1. Initial program 58.9

      \[\]
    2. Taylor expanded around 0 1.1

      \[\leadsto \]
    3. Simplified1.1

      \[\leadsto \]

    if 1.90330772110840095e-6 < x

    1. Initial program 30.1

      \[\]
    2. Using strategy rm
    3. Applied tanh-undef0.1

      \[\leadsto \]
    4. Using strategy rm
    5. Applied add-cube-cbrt0.7

      \[\leadsto \]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.1

    \[\leadsto \]

Reproduce

herbie shell --seed 2020180 
(FPCore (x)
  :name "Hyperbolic tangent"
  :precision binary64
  (/ (- (exp x) (exp (neg x))) (+ (exp x) (exp (neg x)))))