当前位置: 首页>>代码示例>>C++>>正文


C++ PushFloat函数代码示例

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


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

示例1: prim_modf

void
prim_modf(PRIM_PROTOTYPE)
{
	float tresult;
	double dresult;

	CHECKOP(1);
	oper1 = POP();
       if ( oper1->type == PROG_INTEGER ) 
          { oper1->type = PROG_FLOAT;
            oper1->data.fnumber = oper1->data.number;
          }
	if (oper1->type != PROG_FLOAT)
		abort_interp("Non-float argument. (1)");
	if (!no_good(oper1->data.fnumber)) {
		fresult = (float) modf((double) oper1->data.fnumber, &dresult);
	} else {
		fresult = 0.0;
		tresult = 0.0;
		fr->error.error_flags.f_bounds = 1;
	}
	CLEAR(oper1);
	tresult = (float) dresult;
	CHECKOFLOW(2);
	PushFloat(tresult);
	PushFloat(fresult);
}
开发者ID:CyberLeo,项目名称:protomuck,代码行数:27,代码来源:p_float.c

示例2: PushPowHouGrp

static uchar PushPowHouGrp(uchar  ibGrp, uint  iwHhr, uchar  bMultiplier)
{
  if (iwHhr == iwHardHou)
    return PushFloat(GetPowGrpHouCurr(ibGrp, bMultiplier));
  else
    return PushFloat(GetGrpHouInt2Real(mpwImpHouCan[ PrevSoftHou() ], ibGrp, bMultiplier));
}
开发者ID:feilongfl,项目名称:tm4c1294ncpdt,代码行数:7,代码来源:out_minute30.c

示例3: prim_xyz_to_polar

void
prim_xyz_to_polar(PRIM_PROTOTYPE)
{
	float dist, theta, phi;
	double x, y, z;

	CHECKOP(3);
	oper3 = POP();
	oper2 = POP();
	oper1 = POP();
       if ( oper1->type == PROG_INTEGER ) 
          { oper1->type = PROG_FLOAT;
            oper1->data.fnumber = oper1->data.number;
          }
       if ( oper2->type == PROG_INTEGER ) 
          { oper2->type = PROG_FLOAT;
            oper2->data.fnumber = oper1->data.number;
          }
       if ( oper3->type == PROG_INTEGER ) 
          { oper3->type = PROG_FLOAT;
            oper3->data.fnumber = oper1->data.number;
          }
	if (oper1->type != PROG_FLOAT)
		abort_interp("Non-float argument. (1)");
	if (oper2->type != PROG_FLOAT)
		abort_interp("Non-float argument. (2)");
	if (oper3->type != PROG_FLOAT)
		abort_interp("Non-float argument. (3)");

	x = oper1->data.fnumber;
	y = oper2->data.fnumber;
	z = oper3->data.fnumber;

	if (no_good(x) || no_good(y) || no_good(z)) {
		dist = 0.0;
		theta = 0.0;
		phi = 0.0;
		fr->error.error_flags.nan = 1;
	} else {
		dist = (float) sqrt((x * x) + (y * y) + (z * z));
		if (dist > 0.0) {
			theta = (float) atan2(y, x);
			phi = (float) acos(z / dist);
		} else {
			theta = 0.0;
			phi = 0.0;
		}
	}

	CLEAR(oper1);
	CLEAR(oper2);
	CLEAR(oper3);
	PushFloat(dist);
	PushFloat(theta);
	PushFloat(phi);
}
开发者ID:CyberLeo,项目名称:protomuck,代码行数:56,代码来源:p_float.c

示例4: prim_diff3

void
prim_diff3(PRIM_PROTOTYPE)
{
	double xout, yout, zout;
	double x, y, z;
	double x2, y2, z2;

	CHECKOP(3);
	oper3 = POP();
	oper2 = POP();
	oper1 = POP();
	if (oper1->type != PROG_FLOAT)
		abort_interp("Non-float argument. (4)");
	if (oper2->type != PROG_FLOAT)
		abort_interp("Non-float argument. (5)");
	if (oper3->type != PROG_FLOAT)
		abort_interp("Non-float argument. (6)");

	x = oper1->data.fnumber;
	y = oper2->data.fnumber;
	z = oper3->data.fnumber;

	CLEAR(oper1);
	CLEAR(oper2);
	CLEAR(oper3);

	CHECKOP(3);
	oper3 = POP();
	oper2 = POP();
	oper1 = POP();
	if (oper1->type != PROG_FLOAT)
		abort_interp("Non-float argument. (1)");
	if (oper2->type != PROG_FLOAT)
		abort_interp("Non-float argument. (2)");
	if (oper3->type != PROG_FLOAT)
		abort_interp("Non-float argument. (3)");

	x2 = oper1->data.fnumber;
	y2 = oper2->data.fnumber;
	z2 = oper3->data.fnumber;

	CLEAR(oper1);
	CLEAR(oper2);
	CLEAR(oper3);

	xout = x - x2;
	yout = y - y2;
	zout = z - z2;

	PushFloat(xout);
	PushFloat(yout);
	PushFloat(zout);
}
开发者ID:UnderSampled,项目名称:RAOAMUCK,代码行数:53,代码来源:p_float.c

示例5: prim_polar_to_xyz

void
prim_polar_to_xyz(PRIM_PROTOTYPE)
{
	float x, y, z;
	double dist, theta, phi;

	CHECKOP(3);
	oper3 = POP();
	oper2 = POP();
	oper1 = POP();
       if ( oper1->type == PROG_INTEGER ) 
          { oper1->type = PROG_FLOAT;
            oper1->data.fnumber = oper1->data.number;
          }
       if ( oper2->type == PROG_INTEGER ) 
          { oper2->type = PROG_FLOAT;
            oper2->data.fnumber = oper1->data.number;
          }
       if ( oper3->type == PROG_INTEGER ) 
          { oper3->type = PROG_FLOAT;
            oper3->data.fnumber = oper1->data.number;
          }
	if (oper1->type != PROG_FLOAT)
		abort_interp("Non-float argument. (1)");
	if (oper2->type != PROG_FLOAT)
		abort_interp("Non-float argument. (2)");
	if (oper3->type != PROG_FLOAT)
		abort_interp("Non-float argument. (3)");

	dist = oper1->data.fnumber;
	theta = oper2->data.fnumber;
	phi = oper3->data.fnumber;

	if (no_good(dist) || no_good(theta) || no_good(phi)) {
		x = 0.0;
		y = 0.0;
		z = 0.0;
		fr->error.error_flags.nan = 1;
	} else {
		x = (float) (dist * cos(theta) * sin(phi));
		y = (float) (dist * sin(theta) * sin(phi));
		z = (float) (dist * cos(phi));
	}

	CLEAR(oper1);
	CLEAR(oper2);
	CLEAR(oper3);
	PushFloat(x);
	PushFloat(y);
	PushFloat(z);
}
开发者ID:CyberLeo,项目名称:protomuck,代码行数:51,代码来源:p_float.c

示例6: prim_pow

void
prim_pow(PRIM_PROTOTYPE)
{
	CHECKOP(2);
	oper1 = POP();
	oper2 = POP();
	if (oper2->type != PROG_FLOAT)
		abort_interp("Non-float argument. (1)");
	if (oper1->type != PROG_FLOAT)
		abort_interp("Non-float argument. (2)");
	if (!no_good(oper1->data.fnumber) && !no_good(oper2->data.fnumber)) {
		if (fabs(oper2->data.fnumber) < DBL_EPSILON) {
			fresult = 0.0;
		} else if (oper2->data.fnumber < 0.0 &&
			oper1->data.fnumber != floor(oper1->data.fnumber))
		{
			fresult = 0.0;
			fr->error.error_flags.imaginary = 1;
		} else {
			fresult = pow(oper2->data.fnumber, oper1->data.fnumber);
		}
	} else {
		fresult = 0.0;
		fr->error.error_flags.f_bounds = 1;
	}
	CLEAR(oper1);
	CLEAR(oper2);
	PushFloat(fresult);
}
开发者ID:UnderSampled,项目名称:RAOAMUCK,代码行数:29,代码来源:p_float.c

示例7: prim_dist3d

void
prim_dist3d(PRIM_PROTOTYPE)
{
	double dist;
	double x, y, z;

	CHECKOP(3);
	oper3 = POP();
	oper2 = POP();
	oper1 = POP();
	if (oper1->type != PROG_FLOAT)
		abort_interp("Non-float argument. (1)");
	if (oper2->type != PROG_FLOAT)
		abort_interp("Non-float argument. (2)");
	if (oper3->type != PROG_FLOAT)
		abort_interp("Non-float argument. (3)");

	x = oper1->data.fnumber;
	y = oper2->data.fnumber;
	z = oper3->data.fnumber;
	dist = sqrt((x * x) + (y * y) + (z * z));

	CLEAR(oper1);
	CLEAR(oper2);
	CLEAR(oper3);
	PushFloat(dist);
}
开发者ID:UnderSampled,项目名称:RAOAMUCK,代码行数:27,代码来源:p_float.c

示例8: prim_fmod

void
prim_fmod(PRIM_PROTOTYPE)
{
	CHECKOP(2);
	oper1 = POP();
	oper2 = POP();
       if ( oper1->type == PROG_INTEGER ) 
          { oper1->type = PROG_FLOAT;
            oper1->data.fnumber = oper1->data.number;
          }
       if ( oper2->type == PROG_INTEGER ) 
          { oper2->type = PROG_FLOAT;
            oper2->data.fnumber = oper1->data.number;
          }
	if (oper2->type != PROG_FLOAT)
		abort_interp("Non-float argument. (1)");
	if (oper1->type != PROG_FLOAT)
		abort_interp("Non-float argument. (2)");
	if (oper1->data.fnumber < SMALL_NUM && oper1->data.fnumber > NSMALL_NUM) {
		fresult = 0.0;
		fr->error.error_flags.div_zero = 1;
	} else {
		fresult = oper2->data.fnumber / oper1->data.fnumber;
		fresult = fresult - (float) ((int) fresult);
	}
	CLEAR(oper1);
	CLEAR(oper2);
	PushFloat(fresult);
}
开发者ID:CyberLeo,项目名称:protomuck,代码行数:29,代码来源:p_float.c

示例9: prim_sqrt

void
prim_sqrt(PRIM_PROTOTYPE)
{
	CHECKOP(1);
	oper1 = POP();
       if ( oper1->type == PROG_INTEGER ) 
          { oper1->type = PROG_FLOAT;
            oper1->data.fnumber = oper1->data.number;
          }
	if (oper1->type != PROG_FLOAT)
		abort_interp("Non-float argument. (1)");
	if (!no_good(oper1->data.fnumber)) {
		if (oper1->data.fnumber < 0.0) {
			fresult = 0.0;
			fr->error.error_flags.imaginary = 1;
		} else {
			fresult = (float) sqrt((double) oper1->data.fnumber);
		}
	} else {
		fresult = 0.0;
		fr->error.error_flags.f_bounds = 1;
	}
	CLEAR(oper1);
	PushFloat(fresult);
}
开发者ID:CyberLeo,项目名称:protomuck,代码行数:25,代码来源:p_float.c

示例10: prim_tan

void
prim_tan(PRIM_PROTOTYPE)
{
	CHECKOP(1);
	oper1 = POP();
       if ( oper1->type == PROG_INTEGER ) 
          { oper1->type = PROG_FLOAT;
            oper1->data.fnumber = oper1->data.number;
          }
	if (oper1->type != PROG_FLOAT)
		abort_interp("Non-float argument. (1)");
	if (!no_good(oper1->data.fnumber)) {
		fresult = fmod((oper1->data.fnumber - H_PI), F_PI);
		if (fresult < 0.000001 || fresult > (F_PI - 0.000001)) {
			fresult = (float) tan((double) oper1->data.fnumber);
		} else {
			fresult = 0.0;
			fr->error.error_flags.nan = 1;
		}
	} else {
		fresult = 0.0;
		fr->error.error_flags.f_bounds = 1;
	}
	CLEAR(oper1);
	PushFloat(fresult);
}
开发者ID:CyberLeo,项目名称:protomuck,代码行数:26,代码来源:p_float.c

示例11: prim_round

void
prim_round(PRIM_PROTOTYPE)
{
	double temp, tshift, tnum, fstore;

	CHECKOP(2);
	oper1 = POP();
	oper2 = POP();
	if (oper1->type != PROG_INTEGER)
		abort_interp("Non-integer argument. (2)");
	if (oper2->type != PROG_FLOAT)
		abort_interp("Non-float argument. (1)");
	if (oper1->type < 0)
		abort_interp("Precision argument must be a positive integer. (2)");
	if (!no_good(oper2->data.fnumber)) {
		temp = pow(10.0, (double) oper1->data.number);
		tshift = temp * ((double) oper2->data.fnumber);
		tnum = modf(tshift, &fstore);
		if (tnum >= 0.5) {
			fstore = fstore + 1.0;
		} else {
			if (tnum <= -0.5) {
				fstore = fstore - 1.0;
			}
		}
		fstore = fstore / temp;
		fresult = (float) fstore;
	} else {
		fresult = 0.0;
		fr->error.error_flags.f_bounds = 1;
	}
	CLEAR(oper1);
	CLEAR(oper2);
	PushFloat(fresult);
}
开发者ID:CyberLeo,项目名称:protomuck,代码行数:35,代码来源:p_float.c

示例12: prim_pi

void
prim_pi(PRIM_PROTOTYPE)
{
	CHECKOP(0);
	fresult = F_PI;
	CHECKOFLOW(1);
	PushFloat(fresult);
}
开发者ID:CyberLeo,项目名称:protomuck,代码行数:8,代码来源:p_float.c

示例13: prim_inf

void
prim_inf(PRIM_PROTOTYPE)
{
	CHECKOP(0);
	fresult = INF;
	CHECKOFLOW(1);
	PushFloat(fresult);
}
开发者ID:CyberLeo,项目名称:protomuck,代码行数:8,代码来源:p_float.c

示例14: prim_frand

void
prim_frand(PRIM_PROTOTYPE)
{
	CHECKOP(0);
	CHECKOFLOW(1);
	fresult = _int_f_rand();
	PushFloat( fresult );
}
开发者ID:UnderSampled,项目名称:RAOAMUCK,代码行数:8,代码来源:p_float.c

示例15: prim_epsilon

void
prim_epsilon(PRIM_PROTOTYPE)
{
	CHECKOP(0);
	fresult = DBL_EPSILON;
	CHECKOFLOW(1);
	PushFloat(fresult);
}
开发者ID:UnderSampled,项目名称:RAOAMUCK,代码行数:8,代码来源:p_float.c


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