本文整理汇总了C++中precision函数的典型用法代码示例。如果您正苦于以下问题:C++ precision函数的具体用法?C++ precision怎么用?C++ precision使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了precision函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: precision
string asset::to_string()const {
string result = fc::to_string(amount.value / precision());
if( decimals() )
{
auto fract = amount.value % precision();
result += "." + fc::to_string(precision() + fract).erase(0,1);
}
return result + " " + symbol_name();
}
示例2: format
bool QgsRendererRangeV2LabelFormat::operator==( const QgsRendererRangeV2LabelFormat &other ) const
{
return
format() == other.format() &&
precision() == other.precision() &&
trimTrailingZeroes() == other.trimTrailingZeroes();
}
示例3: _t2
/* encode contiguous floating-point block */
uint
_t2(zfp_encode_block, Scalar, DIMS)(zfp_stream* zfp, const Scalar* fblock)
{
/* compute maximum exponent */
int emax = _t1(exponent_block, Scalar)(fblock, BLOCK_SIZE);
int maxprec = precision(emax, zfp->maxprec, zfp->minexp, DIMS);
uint e = maxprec ? emax + EBIAS : 0;
/* encode block only if biased exponent is nonzero */
if (e) {
cache_align_(Int iblock[BLOCK_SIZE]);
/* encode common exponent; LSB indicates that exponent is nonzero */
int ebits = EBITS + 1;
stream_write_bits(zfp->stream, 2 * e + 1, ebits);
/* perform forward block-floating-point transform */
_t1(fwd_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax);
/* encode integer block */
return ebits + _t2(encode_block, Int, DIMS)(zfp->stream, zfp->minbits - ebits, zfp->maxbits - ebits, maxprec, iblock);
}
else {
/* write single zero-bit to indicate that all values are zero */
stream_write_bit(zfp->stream, 0);
if (zfp->minbits > 1) {
stream_pad(zfp->stream, zfp->minbits - 1);
return zfp->minbits;
}
else
return 1;
}
}
示例4: MessageHandler_
MessageHandler_()
: std::ostream(new Buf(*this)), indent(indentLevel * INDENT_SIZE),
beginLine(0), stepCount(0) {
flags(os.flags());
precision(os.precision());
width(os.width());
}
示例5: non_clean_card_iterate_parallel_work
void CardTableModRefBSForCTRS::non_clean_card_iterate_possibly_parallel(
Space* sp,
MemRegion mr,
OopsInGenClosure* cl,
CardTableRS* ct,
uint n_threads)
{
if (!mr.is_empty()) {
if (n_threads > 0) {
#if INCLUDE_ALL_GCS
non_clean_card_iterate_parallel_work(sp, mr, cl, ct, n_threads);
#else // INCLUDE_ALL_GCS
fatal("Parallel gc not supported here.");
#endif // INCLUDE_ALL_GCS
} else {
// clear_cl finds contiguous dirty ranges of cards to process and clear.
// This is the single-threaded version used by DefNew.
const bool parallel = false;
DirtyCardToOopClosure* dcto_cl = sp->new_dcto_cl(cl, precision(), cl->gen_boundary(), parallel);
ClearNoncleanCardWrapper clear_cl(dcto_cl, ct, parallel);
clear_cl.do_MemRegion(mr);
}
}
}
示例6: precision
double ConfusionMatrix::fscore(int category) {
double p = precision(category);
double r = recall(category);
if((p + r) == 0.0)
return 0.0;
return (2 * p * r) / (p + r);
}
示例7: AplusLabelOut
AplusFuncLabel::AplusFuncLabel(A a_, AplusLabelOut *alo_) : AplusLabelOut()
{
if (alo_!=0 && alo_->outFunc()!=0)
{
outFunc(alo_->outFunc());
v(alo_->v());
}
if (alo_!=0 && alo_->format()!=AplusFormatter::BadFormat)
{
format(alo_->format());
precision(alo_->precision());
}
if (verify(a_)==MSTrue)
{
a((A) ic(a_));
}
else
{
MSStringVector emptyStringVector;
a((A)0);
tick((A)0);
grid((A)0);
value((A)0);
labels(emptyStringVector);
}
}
示例8: operator
// network specific types
int operator()(Layout_type const* t)
{
int n = 0;
for (Decl* d : t->declaration()->fields())
n += precision(d->type());
return n;
}
示例9: ft_putloo
void ft_putloo(va_list ap)
{
char *str;
if ((g_trait & OPT_J) == OPT_J)
str = ft_putjo(ap);
else if (g_trait & OPT_Z)
str = ft_putzo(ap);
else if ((g_trait & OPT_LL) == OPT_LL)
str = ft_putllo(ap);
else if ((g_trait & OPT_L) == OPT_L)
str = ft_putlo(ap);
else if ((g_trait & OPT_HH) == OPT_HH)
str = ft_puthho(ap);
else if ((g_trait & OPT_H) == OPT_H)
str = ft_putho(ap);
else
str = ft_putosf(ap);
str = precision(str, 8);
if (ft_strcmp(str, "") == 0 && g_trait & OPT_DIESE)
str = ft_strdup("0");
str = treat_o(str);
g_print += ft_strlen(str);
ft_putstr_fd(str, g_fd);
free(str);
}
示例10: bounds
void CLabHorizScale::drawScale(CDC *pDC)
{
int tickLength;
CRgn rgn;
CRect rect = bounds();
rgn.CreateRectRgn(rect.left, rect.top, rect.right, rect.bottom);
pDC->SelectClipRgn(&rgn);
for(double x=getTickMin(); x<=maximum(); x=x+tickIncrement())
{
double temp = x/(majorTickFrequency()*tickIncrement());
if(temp == ceil(temp))
tickLength = 7;
else
tickLength = 3;
pDC->MoveTo(translateCoordinate(x), rect.top);
pDC->LineTo(translateCoordinate(x), rect.top + tickLength);
temp = x/(tickMarkFrequency() * tickIncrement());
if(temp == ceil(temp))
{
CString tickMarkStr;
tickMarkStr.Format("%.*f", precision(), x);
pDC->TextOut(translateCoordinate(x) - _parent->getCharWidth() * tickMarkStr.GetLength()/2,
rect.top + 7 /* _parent->getCharHeight()*/,
tickMarkStr);
}
}
}
示例11: MessageHandler_
MessageHandler_()
: std::ostream(&buf), buf(*this), indent(indentLevel * INDENT_SIZE),
beginLine(0), totalSteps(0), stepCount(0),
dotCount(0), dotTime(0), stepping(false) {
flags(os.flags());
precision(os.precision());
width(os.width());
}
示例12: Asset
model::AssetResponse PbQueryResponseFactory::deserializeAssetResponse(
const protocol::AssetResponse &response) const {
model::AssetResponse res;
auto asset = response.asset();
res.asset =
Asset(asset.asset_id(), asset.domain_id(), asset.precision());
return res;
}
示例13: precision
double CoverMetrics::f1score() const {
double p = precision();
double r = recall();
if (p + r < std::numeric_limits<double>::epsilon()) {
return std::sqrt(-1); // return NaN
}
return 2*p*r/(p + r);
}
示例14: copyfmt
basic_ios& copyfmt(const ios& right) {
fill(right.fill());
flags(right.flags() );
exceptions(right.exceptions());
width(right.width());
precision(right.precision());
return *this;
}
示例15: toString
/**
* Stringify the data.
* @return the content of asset.
*/
std::string toString() const override {
return detail::PrettyStringBuilder()
.init("Asset")
.append("assetId", assetId())
.append("domainId", domainId())
.append("precision", std::to_string(precision()))
.finalize();
}