<div dir="ltr">I personally prefer throwing an exception.<div><br></div><div>Chris</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 20, 2016 at 9:58 AM, Andy Buckley <span dir="ltr"><<a href="mailto:andy.buckley@cern.ch" target="_blank">andy.buckley@cern.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On 19/07/16 23:10, Holger Schulz wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
the Analysis ATLAS_2010_S8914702 calculates the median of a vector<double><br>
<br>
and currently segfaults if the vector is empty.<br>
<br>
<br>
I don't know whether we should explicitly check the size of the vector or<br>
return 0 in the median function --- not sure if the median of an empty set<br>
is well defined though.<br>
<br>
<br>
What do you think?<br>
</blockquote>
<br></span>
Good spot. Thanks for adding protection to the analysis. If we add protection in the median itself, it would need to be either throwing an exception or returning a nan. Both of those would also need a check in the analysis code.<br>
<br>
I'm going to make a few other tweaks to "utils" functions today, which tends to require a full rebuild since those headers are included everywhere. So I may as well do this at the same time... what approach do we prefer?<span><font color="#888888"><br>
<br>
Andy<br>
<br>
-- <br>
Dr Andy Buckley, Lecturer / Royal Society University Research Fellow<br>
Particle Physics Expt Group, University of Glasgow</font></span><div><div><br>
_______________________________________________<br>
Rivet mailing list<br>
<a href="mailto:Rivet@projects.hepforge.org" target="_blank">Rivet@projects.hepforge.org</a><br>
<a href="https://www.hepforge.org/lists/listinfo/rivet" rel="noreferrer" target="_blank">https://www.hepforge.org/lists/listinfo/rivet</a><br>
</div></div></blockquote></div><br></div></div>