• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ pow10函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中pow10函数的典型用法代码示例。如果您正苦于以下问题:C++ pow10函数的具体用法?C++ pow10怎么用?C++ pow10使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了pow10函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: update_range_lables

static void
update_range_lables(GtkWidget *from, GtkWidget *to, GtkWidget *unit,
                    gdouble min, gdouble max, const gchar *unitstring)
{
    GwySIValueFormat *vf;
    GwySIUnit *siunit;
    gint power10;
    gchar *s;

    siunit = gwy_si_unit_new_parse(unitstring, &power10);
    min *= pow10(power10);
    max *= pow10(power10);
    vf = gwy_si_unit_get_format_with_digits(siunit, GWY_SI_UNIT_FORMAT_VFMARKUP,
                                            MAX(fabs(min), fabs(max)), 3,
                                            NULL);
    s = g_strdup_printf("%.*f", vf->precision, min/vf->magnitude);
    gtk_label_set_markup(GTK_LABEL(from), s);
    g_free(s);
    s = g_strdup_printf("%.*f", vf->precision, max/vf->magnitude);
    gtk_label_set_markup(GTK_LABEL(to), s);
    g_free(s);
    gtk_label_set_markup(GTK_LABEL(unit), vf->units);
    gwy_si_unit_value_format_free(vf);
    g_object_unref(siunit);
}
开发者ID:cbuehler,项目名称:gwyddion,代码行数:25,代码来源:rawxyz.c


示例2: ftoa

/*
 * convert floating to ascii.  ftoa returns an integer e such that
 * f=g*10**e, with .1<=|g|<1 (e=0 when g==0) and puts an ascii
 * representation of g in the buffer pointed to by bp.  bp[0] will
 * be '+' or '-', and bp[1] to bp[NFTOA-2]
 * will be appropriate digits of g. bp[NFTOA-1] will be '\0'
 */
int ftoa(double f, char *bp) {
    int e, e1, e2, i;
    double digit, g, p;
    if(f>=0) *bp++='+';
    else {
        f=-f;
        *bp++='-';
    }
    /* find e such that f==0 or 1<=f*pow10(e)<10, and set f=f*pow10(e) */
    if(f==0.) e=1;
    else {
        frexp(f, &e);
        e=-e*30103/100000;
        /* split in 2 pieces to guard against overflow in extreme cases */
        e1=e/2;
        e2=e-e1;
        p=f*pow10(e2);
        while((g=p*pow10(e1))<1.) e1++;
        while((g=p*pow10(e1))>=10.) --e1;
        e=e1+e2;
        f=g;
    }
    for(i=0; i!=NDIG; i++) {
        f=modf(f, &digit)*10.;
        *bp++=digit+'0';
    }
    *bp='\0';
    return 1-e;
}
开发者ID:npe9,项目名称:harvey,代码行数:36,代码来源:ftoa.c


示例3: main

void main (void)
 {
   printf("10 raised to -1 is %f\n", pow10(-1));
   printf("10 raised to 0 is %f\n", pow10(0));
   printf("10 raised to 1 is %f\n", pow10(1));
   printf("10 raised to 2 is %f\n", pow10(2));
}
开发者ID:guolilong2012,项目名称:study,代码行数:7,代码来源:pow10.c


示例4: parse_exact_real

cons_t* parse_exact_real(const char* sc, int radix)
{
  if ( radix != 10 )
    raise(parser_exception(
      "Only reals with decimal radix are supported"));

  /*
   * Since the real is already in string form, we can simply turn it into a
   * rational number.
   */
  char *s = strdup(sc);
  char *d = strchr(s, '.');
  *d = '\0';
  const char* left = s;
  const char* right = d+1;

  int decimals = strlen(right);

  /*
   * NOTE: If we overflow here, we're in big trouble.
   * TODO: Throw an error if we overflow.  Or just implement bignums.
   */
  rational_t r;
  r.numerator = to_i(left, radix)*pow10(decimals) + to_i(right, radix);
  r.denominator = pow10(decimals);

  free(s);
  return rational(r, true);
}
开发者ID:cslarsen,项目名称:mickey-scheme,代码行数:29,代码来源:parser-converters.cpp


示例5: reverse

int reverse(int x){
  int keta = 1 + (int)log10(x);
  int i,y=0;
  for( i=0; i<keta; i++){
    y += (int)(x / pow10(i)) % 10 * pow10(keta-i-1);
  }
  //  printf("x:%d keta:%d, y:%d, test:%d",x,keta,y,pow10(2));
  return y;
}
开发者ID:amumu,项目名称:nokuno,代码行数:9,代码来源:reverse.c


示例6: fix_scales

static void
fix_scales(EZDSection *section,
           gint idx,
           GwyContainer *container)
{
    GwyDataField *dfield;
    GwySIUnit *siunit;
    gchar key[40];
    gint power10;
    gdouble r;

    g_snprintf(key, sizeof(key), "/%d/data", idx);
    dfield = GWY_DATA_FIELD(gwy_container_get_object_by_name(container, key));

    /* Fix value scale */
    siunit = gwy_si_unit_new_parse(section->zrange.unit, &power10);
    gwy_data_field_set_si_unit_z(dfield, siunit);
    g_object_unref(siunit);
    r = pow10(power10);
    gwy_data_field_multiply(dfield, r*section->zrange.range);
    gwy_data_field_add(dfield, r*section->zrange.min);

    /* Fix lateral scale */
    siunit = gwy_si_unit_new_parse(section->xrange.unit, &power10);
    gwy_data_field_set_si_unit_xy(dfield, siunit);
    g_object_unref(siunit);
    gwy_data_field_set_xreal(dfield, pow10(power10)*section->xrange.range);

    siunit = gwy_si_unit_new_parse(section->yrange.unit, &power10);
    gwy_data_field_set_yreal(dfield, pow10(power10)*section->yrange.range);
    g_object_unref(siunit);

    /* Some metadata */
    if (section->zrange.name) {
        const gchar *s;

        switch (section->direction) {
            case SCAN_FORWARD:
            s = " forward";
            break;

            case SCAN_BACKWARD:
            s = " backward";
            break;

            default:
            s = "";
            break;
        }
        g_snprintf(key, sizeof(key), "/%d/data/title", idx);
        gwy_container_set_string_by_name(container, key,
                                         g_strdup_printf("%s%s",
                                                         section->zrange.name,
                                                         s));
    }
}
开发者ID:svn2github,项目名称:gwyddion,代码行数:56,代码来源:ezdfile.c


示例7: throwBigRealInvalidArgumentException

// Same as getFirst32, but k = [0..MAXDIGITS_INT128] = [0..38]
_uint128 &BigReal::getFirst128(_uint128 &dst, const UINT k, BRExpoType *scale) const {
#ifdef _DEBUG
  DEFINEMETHODNAME;
  if(k > MAXDIGITS_INT128) {
    throwBigRealInvalidArgumentException(method, _T("k=%d. Legal interval is [0..%d]"),k,MAXDIGITS_INT128);
  }
#endif

  const Digit *p = m_first;
  if(p == NULL) {
    if(scale) *scale = 0;
    dst = 0;
    return dst;
  }

  int              tmpScale = 0;
  dst                       = p->n;
  int              digits   = getDecimalDigitCount(p->n), firstDigits = digits;
  if((UINT)digits >= k) {
    dst /= pow10(digits-k); // digits-k <= LOG10_BIGREALBASE, so pow10 will not fail
    if(scale) {
      ADJUSTSCALEMOD10(dst);
    }
  } else { // digits < k
    if(scale) {
      for(p = p->next; (UINT)digits < k; digits += LOG10_BIGREALBASE) {
        if(p) {
          const BRDigitType p10 = pow10(min(LOG10_BIGREALBASE,k-digits));
          dst = dst * p10 + p->n / (BIGREALBASE/p10);
          p = p->next;
        } else {
          tmpScale = k - digits;
          break;
        }
      }
      ADJUSTSCALEMOD10(dst);
    } else { // scale == NULL
      for(p = p->next; (UINT)digits < k; digits += LOG10_BIGREALBASE) {
        const BRDigitType p10 = pow10(min(LOG10_BIGREALBASE,k-digits));
        dst *= p10;
        if(p) {
          dst += p->n / (BIGREALBASE/p10);
          p = p->next;
        }
      }
    }
  }

  if(scale) {
    *scale  = m_expo * LOG10_BIGREALBASE + firstDigits - 1 + tmpScale - k;
  }
  return dst;
}
开发者ID:JesperMikkelsen,项目名称:Big-Numbers,代码行数:54,代码来源:QuotL128.cpp


示例8: rhkspm32_read_data

static GwyDataField*
rhkspm32_read_data(RHKPage *rhkpage)
{
    GwyDataField *dfield;
    const guint16 *p;
    GwySIUnit *siunit;
    gdouble *data;
    const gchar *s;
    gdouble q;
    gint power10;
    guint i, j, xres, yres;

    p = (const guint16*)(rhkpage->buffer + rhkpage->data_offset);
    xres = rhkpage->xres;
    yres = rhkpage->yres;
    // the scales are no longer gurunteed to be positive,
    // so they must be "fixed" here (to enable spectra)
    dfield = gwy_data_field_new(xres, yres,
                                xres*fabs(rhkpage->x.scale),
                                yres*fabs(rhkpage->y.scale),
                                FALSE);

    data = gwy_data_field_get_data(dfield);
    for (i = 0; i < yres; i++) {
        for (j = 0; j < xres; j++)
            data[i*xres + xres-1 - j] = GINT16_FROM_LE(p[i*xres + j]);
    }

    siunit = gwy_data_field_get_si_unit_xy(dfield);
    gwy_si_unit_set_from_string_parse(siunit, rhkpage->x.units, &power10);
    if (power10) {
        q = pow10(power10);
        gwy_data_field_set_xreal(dfield, q*gwy_data_field_get_xreal(dfield));
        gwy_data_field_set_yreal(dfield, q*gwy_data_field_get_yreal(dfield));
    }

    siunit = gwy_data_field_get_si_unit_z(dfield);
    s = rhkpage->z.units;
    /* Fix some silly units */
    if (gwy_strequal(s, "N/sec"))
        s = "s^-1";
    gwy_si_unit_set_from_string_parse(siunit, s, &power10);
    q = pow10(power10);

    gwy_data_field_multiply(dfield, q*fabs(rhkpage->z.scale));
    gwy_data_field_add(dfield, q*rhkpage->z.offset);

    return dfield;
}
开发者ID:DavidMercier,项目名称:gwyddion,代码行数:49,代码来源:rhk-spm32.c


示例9: main

int main()
{
	int i, stage;
	int level;
	int success = 0;
	clock_t start, end;

	srand((unsigned long)time(NULL));

	printf("数値記憶トレーニング\n");

	do {
		printf("挑戦するレベル (%d ~ %d): ", LEVEL_MIN, LEVEL_MAX);
		scanf("%d", &level);
	} while (level < LEVEL_MIN || level > LEVEL_MAX);

	start = clock();
	for (stage = 0; stage < MAX_STAGE; stage++) {
		int ans;
		int input;

		ans = pow10(level-1) + rand() % (pow10(level-1) * 9);

		printf("%d", ans);
		fflush(stdout);
		sleep(125*level);

		int pos = rand() % level;

		printf("\r%*s\r%d 桁目は? 入力: ", level, " ", pos+1);
		scanf("%d", &input);

		if (get_onenum(ans, pos, level) != input) 
			printf("不正解です\n");
		else {
			printf("正解です\n");
			success++;
		}
	}

	end = clock();

	printf("終了\n");
	printf("正答率: %3.2f (%d / %d)\n", (double)(success * 100/MAX_STAGE), success, MAX_STAGE);
	printf("経過時間: %f\n", (double)(end - start)/CLOCKS_PER_SEC);

	return 0;

}
开发者ID:Saito-,项目名称:Meikai_C,代码行数:49,代码来源:kioku_d_one2.c


示例10: timeWidth

void AmplitudeWidget::drawVerticalRefLines()
{
  //Draw the vertical reference lines
  double timeStep = timeWidth() / double(width()) * 150.0; //time per 150 pixels
  double timeScaleBase = pow10(floor(log10(timeStep))); //round down to the nearest power of 10

  //choose a timeScaleStep which is a multiple of 1, 2 or 5 of timeScaleBase
  int largeFreq;
  if(timeScaleBase * 5.0 < timeStep) { largeFreq = 5; }
  else if (timeScaleBase * 2.0 < timeStep) { largeFreq = 2; }
  else { largeFreq = 2; timeScaleBase /= 2; }

  double timePos = floor(leftTime() / (timeScaleBase*largeFreq)) * (timeScaleBase*largeFreq); //calc the first one just off the left of the screen
  int x, largeCounter=-1;
  double ratio = double(width()) / timeWidth();
  double lTime = leftTime();

  for(; timePos <= rightTime(); timePos += timeScaleBase) {
    if(++largeCounter == largeFreq) {
      largeCounter = 0;
      glColor4ub(25, 125, 170, 128); //draw the darker lines
    } else {
      glColor4ub(25, 125, 170, 64); //draw the lighter lines
	}
    x = toInt((timePos-lTime) * ratio);
    mygl_line(x, 0, x, height()-1);
  }
}
开发者ID:Guildenstern,项目名称:Tartini,代码行数:28,代码来源:amplitudewidget.cpp


示例11: main

int
main(int argc, char* argv[])
{
	int div;
	int max=0;
	int val = -1;

	for(div=1;div<1000;++div) {
		int i;
		int digits[1000];
		int ndigits;
		int num = 1;
		int nn = nmultiplier(div);
		memset(digits, 0, sizeof(digits));
		ndigits=0;

		for(i=0;i<1000;++i)
		{
			num *= pow10(nn);
		
			num %= div;

			if(!find(digits, ndigits, num))
				digits[ndigits++]=num;
		}
		if(ndigits>max)
		{
			max = ndigits;
			val=div;
		}
	}
	printf("%d\n", val);
	return 0;
}
开发者ID:fukanchik,项目名称:Euler,代码行数:34,代码来源:main.c


示例12: getColor

void TPercentageText::draw()
{
	ushort color = getColor(1);

	char *string = new char[size.x + 1];
	itoa( Round( percentage * pow10( precisionDigits ) ), string, 10 );

	if( precisionDigits > 0 )
		{
		memmove( &string[strlen( string ) - precisionDigits + 1],
			    &string[strlen( string ) - precisionDigits],
			    precisionDigits + 1 );
		string[strlen( string ) - 1 - precisionDigits] = point;
		}
	strcat( string, percentageString );
	if( string[0] == point )
		{
		memmove( &string[1], string, strlen( string ) + 1 );
		string[0] = '0';
		}

	TDrawBuffer b;
	b.moveChar( 0, ' ', color, size.x );
	b.moveStr( size.x - 1 - strlen( string ), string, color );
	writeLine( 0, 0, size.x, 1, b );

	delete[] string;
}
开发者ID:jskripsky,项目名称:ancient,代码行数:28,代码来源:PRCNTTXT.CPP


示例13: main

int main(void)
{
	#pragma STDC FENV_ACCESS ON
	double y;
	float d;
	int e, i, err = 0;
	struct d_d *p;

	for (i = 0; i < sizeof t/sizeof *t; i++) {
		p = t + i;

		if (p->r < 0)
			continue;
		fesetround(p->r);
		feclearexcept(FE_ALL_EXCEPT);
		y = pow10(p->x);
		e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);

		if (!checkexcept(e, p->e, p->r)) {
			printf("%s:%d: bad fp exception: %s pow10(%a)=%a, want %s",
				p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
			printf(" got %s\n", estr(e));
			err++;
		}
		d = ulperr(y, p->y, p->dy);
		if (!checkulp(d, p->r)) {
			printf("%s:%d: %s pow10(%a) want %a got %a ulperr %.3f = %a + %a\n",
				p->file, p->line, rstr(p->r), p->x, p->y, y, d, d-p->dy, p->dy);
			err++;
		}
	}
	return !!err;
}
开发者ID:andrey-gvrd,项目名称:rusl,代码行数:33,代码来源:pow10.c


示例14: gwy_si_unit_get_format_with_digits

/**
 * gwy_si_unit_get_format_with_digits:
 * @siunit: A SI unit.
 * @style: Unit format style.
 * @maximum: The maximum value to be represented.
 * @sdigits: The number of significant digits the value should have.
 * @format: A value format to set-up, may be %NULL, a new value format is
 *          allocated then.
 *
 * Finds a good format for representing a values with given number of
 * significant digits.
 *
 * The values should be then printed as value/@format->magnitude
 * [@format->units] with @format->precision decimal places.
 *
 * Returns: The value format.  If @format was %NULL, a newly allocated format
 *          is returned, otherwise (modified) @format itself is returned.
 **/
GwySIValueFormat*
gwy_si_unit_get_format_with_digits(GwySIUnit *siunit,
                                   GwySIUnitFormatStyle style,
                                   gdouble maximum,
                                   gint sdigits,
                                   GwySIValueFormat *format)
{
    const GwySIStyleSpec *spec;

    gwy_debug("");
    g_return_val_if_fail(GWY_IS_SI_UNIT(siunit), NULL);

    spec = gwy_si_unit_find_style_spec(style);
    if (!format)
        format = (GwySIValueFormat*)g_new0(GwySIValueFormat, 1);

    maximum = fabs(maximum);
    if (!maximum) {
        format->magnitude = 1;
        format->precision = sdigits;
    }
    else
        format->magnitude
            = gwy_math_humanize_numbers(maximum/pow10(sdigits),
                                        maximum, &format->precision);
    siunit->power10 = ROUND(log10(format->magnitude));
    format->units_gstring = gwy_si_unit_format(siunit, spec,
                                               format->units_gstring);
    format->units = format->units_gstring->str;

    return format;
}
开发者ID:svn2github,项目名称:gwyddion,代码行数:50,代码来源:gwysiunit.c


示例15: bitset_print

/*
 * The following prints a bitset with a 'ruler' that look like this
 *
 *              11111111112222222222333333333344444444445555555555666666666677
 *    012345678901234567890123456789012345678901234567890123456789012345678901
 * xx:........................................................................
 *                                11111111111111111111111111111111111111111111
 *    777777778888888888999999999900000000001111111111222222222233333333334444
 *    234567890123456789012345678901234567890123456789012345678901234567890123
 *    ........................................................................
 *    111111111111111111111111111111111111111111111111111111112222222222222222
 *    444444555555555566666666667777777777888888888899999999990000000000111111
 *    456789012345678901234567890123456789012345678901234567890123456789012345
 *    ........................................................................
 *    2222222222
 *    1111222222
 *    6789012345
 *    ..........
 *
 * to identify individual bits that are set.
 */
static void
bitset_print(bitset_t *bs, char *label, int width)
{
	int	val_start;
	int	val_max;
	int	label_width;
	int	ruler_width;
	int	v, vm, vi;
	int	nl, l;
	int	i;
	int	p;
	char	c;

	val_start = 0;
	val_max = bitset_highbit(bs) + 1;
	if (val_max <= val_start) {
		mdb_printf("%s: empty-set", label);
		return;
	}

	label_width = strlen(label) + 1;
	ruler_width = width - label_width;

	for (v = val_start; v < val_max; v = vm) {
		if ((v + ruler_width) < val_max)
			vm = v + ruler_width;
		else
			vm = val_max;

		nl = log10(vm) - 1;
		for (l = nl; l >= 0; l--) {
			p = pow10(l);
			for (i = 0; i < label_width; i++)
				mdb_printf(" ");

			for (vi = v; vi < vm; vi++) {
				c = '0' + ((vi / p) % 10);
				if ((l == nl) && (c == '0'))
					c = ' ';
				mdb_printf("%c", c);
			}

			mdb_printf("\n");
		}

		if (v == val_start) {
			mdb_printf("%s:", label);
		} else {
			for (i = 0; i < label_width; i++)
				mdb_printf(" ");
		}
		for (vi = v; vi < vm; vi++) {
			if (BT_TEST(bs->bs_set, vi))
				mdb_printf("X");
			else
				mdb_printf(".");
		}
		mdb_printf("\n");
	}
}
开发者ID:AlainODea,项目名称:illumos-gate,代码行数:81,代码来源:bitset.c


示例16: noise_synth_do

static void
noise_synth_do(const NoiseSynthArgs *args,
               const GwyDimensionArgs *dimsargs,
               GwyDataField *dfield)
{
    const NoiseSynthGenerator *generator;
    PointNoiseFunc point_noise;
    GwyRandGenSet *rngset;
    gdouble *data;
    gdouble sigma;
    gint xres, yres, i;

    generator = get_point_noise_generator(args->distribution);
    point_noise = generator->point_noise[args->direction];

    rngset = gwy_rand_gen_set_new(1);
    gwy_rand_gen_set_init(rngset, args->seed);

    xres = gwy_data_field_get_xres(dfield);
    yres = gwy_data_field_get_yres(dfield);
    data = gwy_data_field_get_data(dfield);
    sigma = args->sigma * pow10(dimsargs->zpow10);

    for (i = 0; i < xres*yres; i++)
        data[i] += point_noise(rngset, sigma);

    gwy_rand_gen_set_free(rngset);
}
开发者ID:DavidMercier,项目名称:gwyddion,代码行数:28,代码来源:noise_synth.c


示例17: sigma_init_clicked

static void
sigma_init_clicked(NoiseSynthControls *controls)
{
    gdouble mag = pow10(controls->dims->args->zpow10);
    gtk_adjustment_set_value(GTK_ADJUSTMENT(controls->sigma),
                             controls->zscale/mag);
}
开发者ID:DavidMercier,项目名称:gwyddion,代码行数:7,代码来源:noise_synth.c


示例18: pow10

void QuickAddCapacitorDialog::slotAttemptAutoComplete()
{
    QString text = ui->capacitanceValueLineEdit->text().trimmed();
    //We accept 3 digit value codes with an optional tolerance code
    if(text.length()==3 || text.length()==4){
        QString multiplicandStr = text.left(2);
        QChar multiplierChar = text.at(2);
        bool multiplicandOk;
        int multiplicand = multiplicandStr.toInt(&multiplicandOk);        
        if(multiplicandOk && multiplierChar.isDigit()){
            double capacitance = multiplicand * pow10(-12);
            int multiplierIdx = to_char(multiplierChar) - '0';
            if(multiplierIdx >= 0 && multiplierIdx <= 9){
                capacitance = capacitance * MULTIPLIERS[multiplierIdx];
            }
            QString capacitanceStr = UnitFormatter::format(capacitance, _capacitanceParam.unitSymbol());
            ui->capacitanceValueLineEdit->setText(capacitanceStr);
        }
        if(text.length()==4){
            QChar toleranceChar = text.at(3);
            if(toleranceChar.isLetter()){
                QString tolerance = lookupTolerance(to_char(toleranceChar));
                if(!tolerance.isEmpty()){
                    ui->toleranceLineEdit->setText(tolerance);
                }
            }
        }
    }

}
开发者ID:jassuncao,项目名称:myparts,代码行数:30,代码来源:quickaddcapacitordialog.cpp


示例19: get_number

void get_number( int *a_number, int *times, char *tstring, int *x, int *y )
{
int power;         /* 十的指数,用10的power来乘以数字 */
char achar[2];
char bchar = 0;
achar[1] = 0;

while ( bchar <= 47 || bchar >= 59 )  /* 允许的数字0-9 */
  {
   bchar = getch();
   if ( bchar == 13 )   /* 13 = CR; 用户按了ENTER建  */
     {
      bchar = 48;
      *times = 0;
      break;
     }
  }

 if ( *times )
   {
    achar[0] = bchar;

    outtextxy( *x, *y, achar );
    *x = *x + textwidth( achar );
    tstring[TIMES - ( (*times)--)] = achar[0];
    if ( *times )
    get_number( a_number, times, tstring, x, y );
   }

    power = (int)( pow10(( strlen( tstring ) - ((*times) + 1))));
    bchar = tstring[*times];
    *a_number += ( power  * ( bchar - 48 ));
    (*times )++;
}
开发者ID:eposts,项目名称:Rich,代码行数:34,代码来源:csort.c


示例20: round_up

double round_up( double val, unsigned int dp )
{
    // Some implementations of std::pow does not return the accurate result even
    // for small powers of 10, so we use a specialized routine to calculate them.
    const double denominator = pow10( dp );
    return std::ceil( denominator * val ) / denominator;
}
开发者ID:BrianLefler,项目名称:Cataclysm-DDA,代码行数:7,代码来源:cata_utility.cpp



注:本文中的pow10函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ pow3函数代码示例发布时间:2022-05-30
下一篇:
C++ pow函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap