std::string quantile_field(double quantile) { if (quantile == 0) return "min"; else if (quantile == 0.5) return "median"; else if (quantile == 1) return "max"; else if (quantile > 0 and quantile < 1) return "q" + double_str(quantile, std::numeric_limits<double>::digits10).substr(2); throw std::invalid_argument("invalid argument passed to creativity::data::quantile_field: quantiles must be >= 0 and <= 1"); }
/** * Returns a double value. * * @note The returned value is what we get by converting the string form * of the number to a double. * * @return The double value of the tag. * * @see CECTag(ec_tagname_t, double) */ double CECTag::GetDoubleData(void) const { if (m_dataType != EC_TAGTYPE_DOUBLE) { EC_ASSERT(m_dataType == EC_TAGTYPE_UNKNOWN); return 0; } else if (m_tagData == NULL) { EC_ASSERT(false); return 0; } std::istringstream double_str(m_tagData); double data; double_str >> data; return data; }