Opened 13 years ago
Closed 13 years ago
#660 closed defect (fixed)
median crashes on empty range
Reported by: | Peter | Owned by: | Peter |
---|---|---|---|
Priority: | minor | Milestone: | yat 0.7.2 |
Component: | statistics | Version: | 0.7.1 |
Keywords: | Cc: |
Description
I tried to calculate the median of an empty range
median(x.begin(), x.end(), true)
where x is empty so x.begin()==x.end(). The program crashes with segmentation fault. I think yat should detect this and either return NaN or throw an exception.
Opinions?
Change History (3)
comment:1 Changed 13 years ago by
Component: | test → statistics |
---|---|
Milestone: | yat 0.x+ → yat 0.7.2 |
Owner: | changed from Jari Häkkinen to Peter |
Priority: | major → minor |
comment:2 Changed 13 years ago by
Status: | new → assigned |
---|
Given that Averager::mean() returns NaN when empty, I think median should also return NaN.
comment:3 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Note: See
TracTickets for help on using
tickets.
the relevant code is in class Percentiler