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

C++ PushFloat函数代码示例

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

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



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


示例16: prim_float

void
prim_float(PRIM_PROTOTYPE)
{
	CHECKOP(1);
	oper1 = POP();
	if (oper1->type != PROG_INTEGER)
		abort_interp("Non-integer argument. (1)");
	fresult = (float) oper1->data.number;
	CLEAR(oper1);
	PushFloat(fresult);
}
开发者ID:CyberLeo,项目名称:protomuck,代码行数:11,代码来源:p_float.c


示例17: OutCntCanMonExt

void    OutCntCanMonExt(void)
{
  SaveDisplay();
  sprintf(szHi,"—четчики: %02u-%02u",bInBuff6+1,bInBuff7+1); Clear();

  if ((bInBuff6 < bCANALS) && (bInBuff7 < 12))
  {
    InitPushPtr();

    if (GetDigitalPhone(bInBuff6) != 0)
    {
      PushChar(3);
      PushChar(0xFF);
      PushChar(0xFF);
      PushChar(0xFF);
      PushChar(0xFF);
    }
    else if (mpboEnblCan[bInBuff6] == false)
    {
      PushChar(2);
      PushChar(0xFF);
      PushChar(0xFF);
      PushChar(0xFF);
      PushChar(0xFF);
    }
    else
    {
      uchar p = ibPort;
      double2 db2 = ReadCntMonCan(bInBuff7,bInBuff6);
      ibPort = p;

      if (db2.fValid == false)
      {
        PushChar(1);
        PushChar(0xFF);
        PushChar(0xFF);
        PushChar(0xFF);
        PushChar(0xFF);
      }
      else
      {
        PushChar(0);
        PushFloat(db2.dbValue);
      }
    }

    OutptrOutBuff(1+sizeof(float));
  }
  else Result(bRES_BADADDRESS);

  LoadDisplay();
  NextPause(); // внимание !
}
开发者ID:feilongfl,项目名称:tm4c1294ncpdt,代码行数:53,代码来源:out_cntmon.c


示例18: prim_systime_precise

void
prim_systime_precise(PRIM_PROTOTYPE)
{
    struct timeval fulltime;
    double dbltime;

    CHECKOP(0);
    gettimeofday(&fulltime, (struct timezone *) 0);
    CHECKOFLOW(1);
    dbltime = fulltime.tv_sec + (((double) fulltime.tv_usec) / 1.0e6);
    PushFloat(dbltime);
}
开发者ID:foxbird,项目名称:fuzzball,代码行数:12,代码来源:p_misc.c


示例19: prim_atan

void
prim_atan(PRIM_PROTOTYPE)
{
	CHECKOP(1);
	oper1 = POP();
	if (oper1->type != PROG_FLOAT)
		abort_interp("Non-float argument. (1)");
	if (!no_good(oper1->data.fnumber)) {
		fresult = atan(oper1->data.fnumber);
	} else {
		fresult = H_PI;
	}
	CLEAR(oper1);
	PushFloat(fresult);
}
开发者ID:UnderSampled,项目名称:RAOAMUCK,代码行数:15,代码来源:p_float.c


示例20: prim_atan2

void
prim_atan2(PRIM_PROTOTYPE)
{
	CHECKOP(2);
	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)");
	fresult = atan2(oper1->data.fnumber, oper2->data.fnumber);
	CLEAR(oper1);
	CLEAR(oper2);
	PushFloat(fresult);
}
开发者ID:UnderSampled,项目名称:RAOAMUCK,代码行数:15,代码来源:p_float.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ PushState函数代码示例发布时间:2022-05-30
下一篇:
C++ PushCommand函数代码示例发布时间: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