Changeset 936 for trunk/yat/statistics


Ignore:
Timestamp:
Oct 6, 2007, 1:02:08 AM (14 years ago)
Author:
Peter
Message:

reimplementing yat_assert as a throwing function

Location:
trunk/yat/statistics
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/statistics/AveragerPairWeighted.h

    r916 r936  
    3333
    3434#include <cmath>
     35#include <stdexcept>
    3536
    3637namespace theplu{
     
    200201  {
    201202    for (size_t i=0; i<x.size(); ++i){
    202       yat_assert(!std::isnan(x[i]));
     203      utility::yat_assert<std::runtime_error>(!std::isnan(x[i]));
    203204      add(x[i],y[i],wx[i],wy[i]);
    204205    }
  • trunk/yat/statistics/utility.h

    r934 r936  
    3535#include <algorithm>
    3636#include <cmath>
     37#include <stdexcept>
    3738#include <vector>
    3839
     
    161162  double percentile(T first, T last, double p, bool sorted=false)
    162163  {
    163     yat_assert(first<last && "range is invalid");
    164     yat_assert(p>=0);
    165     yat_assert(p<=100);
     164    utility::yat_assert<std::range_error>(first<last);
     165    utility::yat_assert<std::runtime_error>(p>=0, "percentage is negative");
     166    utility::yat_assert<std::runtime_error>(p<=100,
     167                                            "percentage is larger than 100");
    166168    if (sorted){
    167169      if (p>=100)
Note: See TracChangeset for help on using the changeset viewer.