Average Error: 30.0 → 0.0
Time: 11.6s
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

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

Derivation

  1. Initial program 30.0

    \[\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 2019016 +o rules:numerics
(FPCore (x)
  :name "tanhf (example 3.4)"
  :herbie-expected 2

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

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

Details

Time bar (total: 11.3s)Debug log

sample333.0ms

Algorithm
intervals
Results
256×(pre true 80)
95×(body real 1280)
54×(body real 640)
47×(body real 2560)
31×(body real 320)
15×(body real 160)
14×(body real 80)

simplify8.0ms

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

prune7.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0b

localize31.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

prune5.0ms

Pruning

1 alts after pruning (0 fresh and 1 done)

Merged error: 0b

end0.0ms

sample10.9s

Algorithm
intervals
Results
8000×(pre true 80)
2832×(body real 1280)
1829×(body real 640)
1581×(body real 2560)
886×(body real 320)
497×(body real 160)
370×(body real 80)
(body real 5120)