Average Error: 58.2 → 0.9
Time: 3.1s
Precision: binary64
\[\]
\[\]

Error

Bits error versus x

Derivation

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

    1. Initial program 58.9

      \[\]
    2. Taylor expanded around 0 1.0

      \[\leadsto \]
    3. Simplified1.0

      \[\leadsto \]

    if 3.04088380892254773e-6 < x

    1. Initial program 31.6

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

      \[\leadsto \]
    4. Using strategy rm
    5. Applied add-cbrt-cube0.3

      \[\leadsto \]
    6. Simplified0.3

      \[\leadsto \]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.9

    \[\leadsto \]

Reproduce

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