Average Error: 30.7 → 0.0
Time: 11.4s
Precision: 64
Internal Precision: 128
\[\frac{1 - \cos x}{\sin x}\]
\[\tan \left(\frac{x}{2}\right)\]

Error

Bits error versus x

Target

Original30.7
Target0.0
Herbie0.0
\[\tan \left(\frac{x}{2}\right)\]

Derivation

  1. Initial program 30.7

    \[\frac{1 - \cos x}{\sin x}\]
  2. Simplified0.0

    \[\leadsto \color{blue}{\tan \left(\frac{x}{2}\right)}\]
  3. Final simplification0.0

    \[\leadsto \tan \left(\frac{x}{2}\right)\]

Reproduce

herbie shell --seed 2019093 
(FPCore (x)
  :name "tanhf (example 3.4)"
  :herbie-expected 2

  :herbie-target
  (tan (/ x 2))

  (/ (- 1 (cos x)) (sin x)))