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

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 29.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 2019026 
(FPCore (x)
  :name "tanhf (example 3.4)"
  :herbie-expected 2

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

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