Average Error: 29.7 → 0.0
Time: 17.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 1137770271 
(FPCore (x)
  :name "tanhf (example 3.4)"
  :herbie-expected 2

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

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

Details

Time bar (total: 16.5s)Debug log

sample467.0ms

Algorithm
intervals
Results
58×199.0ms(body real 2560)
82×131.0ms(body real 1280)
61×82.0ms(body real 640)
36×28.0ms(body real 320)
13×6.0ms(body real 160)
256×6.0ms(pre true 80)
2.0ms(body real 80)

simplify18.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
18.0ms
(/ (- 1 (cos x)) (sin x))

prune18.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0b

localize18.0ms

Local error

Found 0 expressions with local error:

rewrite0.0ms

Algorithm
rewrite-expression-head
Rules
Counts
0 → 0
Calls
0 calls:
Slowest

series0.0ms

Counts
0 → 0
Calls
0 calls:
Slowest

simplify0.0ms

Counts
0 → 0
Calls
0 calls:
Slowest

prune6.0ms

Pruning

1 alts after pruning (0 fresh and 1 done)

Merged error: 0b

end0.0ms

sample16.0s

Algorithm
intervals
Results
1569×6.2s(body real 2560)
2697×4.8s(body real 1280)
1869×2.8s(body real 640)
988×1.4s(body real 320)
502×312.0ms(body real 160)
8000×241.0ms(pre true 80)
371×106.0ms(body real 80)
24.0ms(body real 5120)