本文整理汇总了C++中precision函数的典型用法代码示例。如果您正苦于以下问题:C++ precision函数的具体用法?C++ precision怎么用?C++ precision使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了precision函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:Bitcoinsulting,项目名称:steem,代码行数:9,代码来源:asset.cpp
示例2: format
bool QgsRendererRangeV2LabelFormat::operator==( const QgsRendererRangeV2LabelFormat &other ) const
{
return
format() == other.format() &&
precision() == other.precision() &&
trimTrailingZeroes() == other.trimTrailingZeroes();
}
开发者ID:Margaral,项目名称:QGIS,代码行数:7,代码来源:qgsgraduatedsymbolrendererv2.cpp
示例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;
}
}
开发者ID:Kitware,项目名称:VTK,代码行数:30,代码来源:encodef.c
示例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());
}
开发者ID:an3iitho,项目名称:graphillion,代码行数:7,代码来源:MessageHandler.hpp
示例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);
}
}
}
开发者ID:benbenolson,项目名称:hotspot_9_mc,代码行数:27,代码来源:cardTableModRefBSForCTRS.cpp
示例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);
}
开发者ID:willcannings,项目名称:quarry,代码行数:7,代码来源:confusion_matrix.cpp
示例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);
}
}
开发者ID:PlanetAPL,项目名称:a-plus,代码行数:28,代码来源:AplusLabelOut.C
示例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;
}
开发者ID:thehexia,项目名称:steve,代码行数:8,代码来源:length.cpp
示例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);
}
开发者ID:ThomasSan,项目名称:42sh,代码行数:26,代码来源:o_fct.c
示例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);
}
}
}
开发者ID:fville,项目名称:MFCLabWidget,代码行数:34,代码来源:LabHorizScale.cpp
示例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());
}
开发者ID:K-Sonoda,项目名称:graphillion,代码行数:8,代码来源:MessageHandler.hpp
示例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;
}
开发者ID:kevinmcmahon,项目名称:iroha,代码行数:8,代码来源:pb_query_response_factory.cpp
示例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);
}
开发者ID:estnltk,项目名称:pfe,代码行数:8,代码来源:CoverMetrics.cpp
示例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;
}
开发者ID:ALuehmann,项目名称:labstreaminglayer,代码行数:8,代码来源:workarounds_gcc-2_95.hpp
示例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();
}
开发者ID:kevinmcmahon,项目名称:iroha,代码行数:12,代码来源:asset.hpp
示例16: precision
//------------------------------------------------------------------------------
void ostream::putDouble(double n) {
uint8_t nd = precision();
double round = 0.5;
char sign;
char buf[13]; // room for sign, 10 digits, '.', and zero byte
char *end = buf + sizeof(buf) - 1;
char *str = end;
// terminate string
*end = '\0';
// get sign and make nonnegative
if (n < 0.0) {
sign = '-';
n = -n;
} else {
sign = flags() & showpos ? '+' : '\0';
}
// check for larger than uint32_t
if (n > 4.0E9) {
pgm err(PSTR("BIG FLT"));
putPgm(err);
return;
}
// round up and separate in and fraction parts
for (uint8_t i = 0; i < nd; ++i) round *= 0.1;
n += round;
uint32_t intPart = n;
double fractionPart = n - intPart;
// format intPart and decimal point
if (nd || (flags() & showpoint)) *--str = '.';
str = fmtNum(intPart, str, 10);
// calculate length for fill
uint8_t len = sign ? 1 : 0;
len += nd + end - str;
// extract adjust field
fmtflags adj = flags() & adjustfield;
if (adj == internal) {
if (sign) putch(sign);
do_fill(len);
} else {
// do fill for internal or right
fill_not_left(len);
if (sign) *--str = sign;
}
putstr(str);
// output fraction
while (nd-- > 0) {
fractionPart *= 10.0;
int digit = static_cast<int>(fractionPart);
putch(digit + '0');
fractionPart -= digit;
}
// do fill if not done above
do_fill(len);
}
开发者ID:Giuseppe33,项目名称:Arduino-Sketchbook,代码行数:59,代码来源:ostream.cpp
示例17: ostream
SVOutStream::SVOutStream(ostream& out, const String& sep,
const String& replacement,
String::QuotingMethod quoting) :
ostream(out.rdbuf()), sep_(sep), replacement_(replacement), nan_("nan"),
inf_("inf"), quoting_(quoting), modify_strings_(true), newline_(true)
{
// use high decimal precision (appropriate for double):
precision(std::numeric_limits<double>::digits10);
}
开发者ID:BioITer,项目名称:OpenMS,代码行数:9,代码来源:SVOutStream.C
示例18:
ACE_UINT32
ACE_Stats_Value::fractional_field (void) const
{
if (precision () == 0)
{
return 1;
}
else
{
ACE_UINT32 field = 10;
for (u_int i = 0; i < precision () - 1; ++i)
{
field *= 10;
}
return field;
}
}
开发者ID:BackupTheBerlios,项目名称:pyasynchio-svn,代码行数:18,代码来源:Stats.cpp
示例19: writeLogfileEntry
void writeLogfileEntry(std::ofstream &ofLog, const std::string &sFilename, int tp, int fp, int fn)
{
ofLog << sFilename << std::endl;
ofLog << "# faces: " << tp+fn;
ofLog << ", # detected faces: " << tp+fp << std::endl;
ofLog << "tp = " << tp << ", fp = " << fp << ", fn = " << fn;
ofLog << ", pr = " << precision(tp, fp);
ofLog << ", rc = " << recall(tp, fn) << std::endl;
ofLog.flush();
}
开发者ID:ExtremeModerate,项目名称:lr-facetags,代码行数:10,代码来源:benchmark.cpp
示例20: dot
bool UVSphere::hit(const Ray& r, precision tMin, precision tMax, precision time, HitRecord& record) const{
Vector3 temp = r.origin() - center;
double a = dot(r.direction(), r.direction());
double b = 2 * dot(r.direction(), temp);
double c = dot(temp, temp) - radius * radius;
double discriminant = b * b - 4 * a * c;
//First check to see if the ray intersects the sphere
if(discriminant > 0){
discriminant = sqrt(discriminant);
double t = (- b - discriminant) / (2 * a);
//Now check for a valid interval
if(t < tMin)
t = (- b + discriminant) / (2 * a);
if(t < tMin || t > tMax)
return false;
//We have a valid hit
record.t = (precision)t;
record.hitP = (r.origin() + (precision)t * r.direction());
//record.normal = unitVector(r.origin() + (precision)t * r.direction() - center);
Vector3 n = record.normal = (record.hitP - center) / radius;
//Calculate UV coordinates
precision twopi = precision(2 * M_PI);
precision one_over_2pi = precision(M_1_PI / 2) ;
precision theta = acos(n.z());
precision phi = atan2(n.y(), n.x());
if (phi < 0.0f)
phi += twopi;
record.uv = Vector2(precision(phi * one_over_2pi), precision((M_PI - theta) * M_1_PI));
return true;
}
return false;
}
开发者ID:solarmist,项目名称:Ray-Tracer,代码行数:40,代码来源:UVSphere.cpp
注:本文中的precision函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论