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

C++ cosl函数代码示例

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

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



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

示例1: QMainWindow

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    bouncyPhysics(false),
    simulationPaused(false),
    gravityPhysics(true),
    simulationBorder(false),
    deltaT(TIMER_INTERVAL*3)
{
    ui->setupUi(this);
    ui_bouncyToggle = findChild<QPushButton*>("bouncyToggle");
    ui_pauseToggle = findChild<QPushButton*>("pauseToggle");
    ui_gravityToggle = findChild<QPushButton*>("gravityToggle");
    ui_borderToggle = findChild<QPushButton*>("borderToggle");
    this->updateButtons();
    // set black background
    QPalette Pal(palette());
    Pal.setColor(QPalette::Background, Qt::black);
    this->setAutoFillBackground(true);
    this->setPalette(Pal);
    timerID = startTimer(TIMER_INTERVAL);

    //testing
    long double alfa = 0;
    long double v = 70;
    long double promien = 200;
    long double srodekX = 640;
    long double srodekY = 360;
    int NUMBER_OF_ORBS = 20;
    celestialBody cb;
    for (int i = 1; i <= NUMBER_OF_ORBS; i++)
    {

        cb.makePlanet(srodekX+cosl(alfa)*promien,srodekY+sinl(alfa)*promien);
        cb.setVelocity(sinl(alfa)*v,-cosl(alfa)*v);
        cbodies.push_back(cb);
        alfa+=2*M_PI/NUMBER_OF_ORBS;
    }
    alfa = 0;
    v = -30;
    promien = 100;
    srodekX = 640;
    srodekY = 360;
    NUMBER_OF_ORBS = 10;
    for (int i = 1; i <= NUMBER_OF_ORBS; i++)
    {
        cb.makePlanet(srodekX+cosl(alfa)*promien,srodekY+sinl(alfa)*promien);
        cb.setVelocity(sinl(alfa)*v,-cosl(alfa)*v);
        cb.setBrushColor(QColor(Qt::red));
        cb.setPenColor(QColor(200,100,100));
        cbodies.push_back(cb);
        alfa+=2*M_PI/NUMBER_OF_ORBS;
    }
}
开发者ID:StylishTriangles,项目名称:grawitacja,代码行数:54,代码来源:mainwindow.cpp


示例2: compl_resta

compl compl_resta(const compl a, const compl b){
    compl z;

    real x, y, k, w ;
    x = a.mod * cosl(a.ang);
    y = a.mod * sinl(a.ang);
    w = b.mod * cosl(b.ang);
    k = b.mod * sinl(b.ang);

    z = compl_create((x - w),(y - k));
    return z;

}
开发者ID:Tinix,项目名称:complex-mod-ang,代码行数:13,代码来源:complejo.c


示例3: CLANG_PORT_DECL

long double complex CLANG_PORT_DECL(ccosl) (long double complex Z)
{
  long double complex Res;
  __real__ Res = cosl (__real__ Z) * coshl ( __imag__ Z);
  __imag__ Res = -sinl (__real__ Z) * sinhl ( __imag__ Z);
  return Res;
}
开发者ID:maeikei,项目名称:port-rt,代码行数:7,代码来源:ccosl.c


示例4: ccosl

long double complex ccosl (long double complex Z)
{
  long double complex Res;
  __real__ Res = cosl (__real__ Z) * coshl ( __imag__ Z);
  __imag__ Res = -sinl (__real__ Z) * sinhl ( __imag__ Z);
  return Res;
}
开发者ID:MiUishadow,项目名称:binutils,代码行数:7,代码来源:ccosl.c


示例5: CLANG_PORT_DECL

long double complex CLANG_PORT_DECL(cpowl) (long double complex X, long double complex Y)
{
  long double complex Res;
  long double i;
  long double r = hypotl (__real__ X, __imag__ X);
  if (r == 0.0L)
    {
       __real__ Res = __imag__ Res = 0.0L;
    }
  else
    {
      long double rho;
      long double theta;
      i = cargl (X);
      theta = i * __real__ Y;
 
      if (__imag__ Y == 0.0L)
	/* This gives slightly more accurate results in these cases. */
   	rho = powl (r, __real__ Y);
      else
	{
          r = logl (r);
	  /* rearrangement of cexp(X * clog(Y)) */
	  theta += r * __imag__ Y;
	  rho = expl (r * __real__ Y - i * __imag__ Y);
	}

      __real__ Res = rho * cosl (theta);
      __imag__ Res = rho * sinl (theta);
    }
  return  Res;
}
开发者ID:maeikei,项目名称:port-rt,代码行数:32,代码来源:cpowl.c


示例6: cm_float_cos

void
cm_float_cos(unsigned argc, obj_t args)
{
  obj_t recvr = CAR(args);
  
  m_float_new(consts.cl._float, cosl(FLOAT(recvr)->val));
}
开发者ID:hpersh,项目名称:ool2,代码行数:7,代码来源:math.c


示例7: uvm_os_wrap_libmath_cosl

extern "C" void uvm_os_wrap_libmath_cosl(CDataStack& dataStack)
{
	long double x=dataStack.pop().getReal();
	long double result=cosl(x);

	dataStack.push(result);
}
开发者ID:BackupTheBerlios,项目名称:uop-svn,代码行数:7,代码来源:uvm_os_math.cpp


示例8: asinl

long double asinl(long double x)
{
  long double y, y_sin, y_cos;

  y = 0;

  while (1)
    {
      y_sin = sinl(y);
      y_cos = cosl(y);

      if (y > M_PI_2 || y < -M_PI_2)
        {
          y = fmodl(y, M_PI);
        }

      if (y_sin + LDBL_EPSILON >= x && y_sin - LDBL_EPSILON <= x)
        {
          break;
        }

      y = y - (y_sin - x) / y_cos;
    }

  return y;
}
开发者ID:FreddieChopin,项目名称:NuttX,代码行数:26,代码来源:lib_asinl.c


示例9: test_cos

void test_cos()
{
    static_assert((std::is_same<decltype(cos((double)0)), double>::value), "");
    static_assert((std::is_same<decltype(cosf(0)), float>::value), "");
    static_assert((std::is_same<decltype(cosl(0)), long double>::value), "");
    assert(cos(0) == 1);
}
开发者ID:Bluerise,项目名称:bitrig,代码行数:7,代码来源:math_h.pass.cpp


示例10: _y1

    D_TYPE _CALLTYPE1 _y1( D_TYPE x )
#endif
{
D_TYPE	z, P1, Q1;


    /* if the argument is negative, set EDOM error, print an error message,
     * and return -HUGE
     */

    if (x < 0.0)
	return( domain_err(OP_Y1, x, LD_IND) );

    /* if x <= 7.5  use Hart YONE 6444, the low range approximation */

    if ( x <= 7.5 )
	return( x*evaluate( x*x, Y1p, 7, Y1q, 8)
			       + (2.0/PI)*(_j1l(x)*logl(x) - 1.0/x) );


    /* else if x > 7.5	use Hart PONE 6749 and QONE 7149, the high range
       approximation */

    else {
	z = 8.0/x;
	P1 = evaluate( z*z, P1p, 5, P1q, 5);
	Q1 = z*evaluate( z*z, Q1p, 5, Q1q, 5);
	return(  sqrtl(2.0/(PI*x))*
			 ( P1*sinl(x-3.0*PI/4.0) + Q1*cosl(x-3.0*PI/4.0) )   );
	}
}
开发者ID:chunhualiu,项目名称:OpenNT,代码行数:31,代码来源:bessell.c


示例11: _y0

    D_TYPE _CALLTYPE1 _y0( D_TYPE x )
#endif
{
D_TYPE	z, P0, Q0;


    /* if the argument is negative, set EDOM error, print an error message,
     * and return -HUGE
     */

    if (x < 0.0)
	return( domain_err(OP_Y0 , x, LD_IND) );


    /* if x <= 7.5 use Hart YZERO 6245, the low range approximation */

    if ( x <= 7.5 )
	return( evaluate( x*x, Y0p, 8, Y0q, 8) + (2.0/PI)*_j0l(x)*logl(x) );


    /* else if x > 7.5 use Hart PZERO 6548 and QZERO 6948, the high range
       approximation */

    else {
	z = 8.0/x;
	P0 = evaluate( z*z, P0p, 5, P0q, 5);
	Q0 = z*evaluate( z*z, Q0p, 5, Q0q, 5);
	return( sqrtl(2.0/(PI*x))*(P0*sinl(x-PI/4) + Q0*cosl(x-PI/4)) );
	}
}
开发者ID:chunhualiu,项目名称:OpenNT,代码行数:30,代码来源:bessell.c


示例12: _j1

    D_TYPE _CALLTYPE1 _j1( D_TYPE x )
#endif
{
D_TYPE	z, P1, Q1;
int	sign;

     /* if the argument is negative, take the absolute value and set sign */

     sign = 1;
     if( x < 0.0 ){
	x = -x;
	sign = -1;
	}

     /* if x <= 7.5  use Hart JONE 6047 */

     if ( x <= 7.5 )
	return( sign*x*evaluate( x*x, J1p, 10, J1q, 4) );


    /* else if x > 7.5	use Hart PONE 6749 and QONE 7149, the high range
       approximation */

    else {
	z = 8.0/x;
	P1 = evaluate( z*z, P1p, 5, P1q, 5);
	Q1 = z*evaluate( z*z, Q1p, 5, Q1q, 5);
	return( sign*sqrtl(2.0/(PI*x))*
			   ( P1*cosl(x-3.0*PI/4.0) - Q1*sinl(x-3.0*PI/4.0) )  );
	}
}
开发者ID:chunhualiu,项目名称:OpenNT,代码行数:31,代码来源:bessell.c


示例13: _j0

    D_TYPE _CALLTYPE1 _j0( D_TYPE x )
#endif
{
D_TYPE	z, P0, Q0;

    /* if the argument is negative, take the absolute value */

    if ( x < 0.0 )
	x = - x;

    /* if x <= 7.5  use Hart JZERO 5847 */

    if ( x <= 7.5 )
	return( evaluate( x*x, J0p, 11, J0q, 4) );

    /* else if x >= 7.5  use Hart PZERO 6548 and QZERO 6948, the high range
       approximation */

    else {
	z = 8.0/x;
	P0 = evaluate( z*z, P0p, 5, P0q, 5);
	Q0 = z*evaluate( z*z, Q0p, 5, Q0q, 5);
	return( sqrtl(2.0/(PI*x))*(P0*cosl(x-PI/4) - Q0*sinl(x-PI/4)) );
	}
}
开发者ID:chunhualiu,项目名称:OpenNT,代码行数:25,代码来源:bessell.c


示例14: Coseno

void
Coseno (Token ** Pila)
{
  Token *Operando = EntornoEjecucion_BuscaSimbolo (*Pila);
  if (Buzon.GetHuboError ())
    return;
  if (NoEsReal (Operando))
    {
      BorrarTokenSiEsVariable (Operando);
      return;
    }
  long double ValorRetorno;
  long double ValorDominio = Operando->GetDatoReal ();
  BorrarTokenSiEsVariable (Operando);
  ValorDominio = Estado.AngulosEnGrados ? ValorDominio * (M_PI / 180.0L) :
    ValorDominio;
  if (fabsl (sinl (ValorDominio)) == 1.0L)
    ValorRetorno = 0.0L;
  else
    ValorRetorno = cosl (ValorDominio);
  if (Buzon.GetHuboError ())
    return;
  Token *TokenRetorno = ConsigueToken (ValorRetorno);
  if (Buzon.GetHuboError ())
    return;
  delete Desapila (Pila);
  Apila (Pila, TokenRetorno);
  if (FueraDeRango (TokenRetorno))
    return;
  return;
}
开发者ID:DX94,项目名称:freedfd,代码行数:31,代码来源:funcion.cpp


示例15: Asteroide

void Game::addAsteroide(){
	Asteroide* asteroide;
	long double x, y, angle;	

	int MAX_VERT = 5 + (rand() % (int)(20 - 5 + 1));
    int diametro = 1 + (rand() % (int)(100 - 1 + 1));

    asteroide = new Asteroide(MAX_VERT);

    int POSICION_X = rand()%800;
	int POSICION_Y = rand()%600;

	

	asteroide -> setDiametro(diametro);
	asteroide -> setTipoDireccion(rand()%7);
	asteroide -> setVelocidad(200 / diametro);

	for( int w = 0; w < asteroide -> getNumeroVertices(); w++)
    {
        angle = 360.0/asteroide -> getNumeroVertices();
        int variacion  = int(0.3 * ( asteroide -> getDiametro() + 1) );
        x = cosl(w * angle*PI/180.0) * (asteroide -> getDiametro()) + POSICION_X + rand()%variacion;
        y = sinl(w * angle*PI/180.0) * (asteroide -> getDiametro()) + POSICION_Y + rand()%variacion;
			        
        asteroide -> addVertice(Vector2D(x, y), w);
		if (w == 0)
			asteroide -> addVertice(Vector2D(x, y), asteroide -> getNumeroVertices());
    }
    asteroides.emplace_back(*asteroide);
}
开发者ID:darcusfenix,项目名称:lsdl2,代码行数:31,代码来源:Game.cpp


示例16: cexpl

long double complex cexpl (long double complex Z)
{
  long double complex  Res;
  long double rho = expl (__real__ Z);
  __real__ Res = rho * cosl(__imag__ Z);
  __imag__ Res = rho * sinl(__imag__ Z);
  return Res;
}
开发者ID:MiUishadow,项目名称:binutils,代码行数:8,代码来源:cexpl.c


示例17: compl_print

void compl_print(const compl c){
    /* DESC: Imprime en pantalla c con formato a + i b. */
    real x,y;
    x = c.mod * cosl(c.ang); 
    y = c.mod * sinl(c.ang);

    printf("el numero complejo es : \t %Lf + i * %Lf \n",x ,y);
}
开发者ID:Tinix,项目名称:complex-mod-ang,代码行数:8,代码来源:complejo.c


示例18: test1l

long double test1l(long double x)
{
	long double y1, y2;

	y1 = sinl(x);
	y2 = cosl(x);

	return y1 - y2;
}
开发者ID:0day-ci,项目名称:gcc,代码行数:9,代码来源:builtins-36.c


示例19: impulse_error

float impulse_error(int N, int sign, float *data) {
#ifdef __ANDROID__
	double delta_sum = 0.0f;
	double sum = 0.0f;
#else
	long double delta_sum = 0.0f;
	long double sum = 0.0f;
#endif 

	int i;
	for(i=0;i<N;i++) {
#ifdef __ANDROID__
		double re, im;
		if(sign < 0) {
			re = cos(2 * PI * (double)i / (double)N); 
			im = -sin(2 * PI * (double)i / (double)N); 
		}else{
			re = cos(2 * PI * (double)i / (double)N); 
			im = sin(2 * PI * (double)i / (double)N); 
		}
#else
		long double re, im;
		if(sign < 0) {
			re = cosl(2 * PI * (long double)i / (long double)N); 
			im = -sinl(2 * PI * (long double)i / (long double)N); 
		}else{
			re = cosl(2 * PI * (long double)i / (long double)N); 
			im = sinl(2 * PI * (long double)i / (long double)N); 
		}
#endif
		sum += re * re + im * im;

		re = re - data[2*i];
		im = im - data[2*i+1];
		
		delta_sum += re * re + im * im;

	}
#ifdef __ANDROID__
	return sqrt(delta_sum) / sqrt(sum);
#else
	return sqrtl(delta_sum) / sqrtl(sum);
#endif
}
开发者ID:RTsGIT,项目名称:ffts,代码行数:44,代码来源:test.c


示例20: main

int
main ()
{
  printf ("%.16Lg\n", cosl(0.7853981633974483096156608458198757210492));
  printf ("%.16Lg\n", cosl(0.7853981633974483096156608458198757210492 *29));
  printf ("%.16Lg\n", cosl(0.7853981633974483096156608458198757210492 *2));
  printf ("%.16Lg\n", cosl(0.7853981633974483096156608458198757210492 *30));
  printf ("%.16Lg\n", cosl(0.7853981633974483096156608458198757210492 *4));
  printf ("%.16Lg\n", cosl(0.7853981633974483096156608458198757210492 *32));
  printf ("%.16Lg\n", cosl(0.7853981633974483096156608458198757210492 *2/3));
  printf ("%.16Lg\n", cosl(0.7853981633974483096156608458198757210492 *4/3));
}
开发者ID:MrVertinskis,项目名称:smalltalk,代码行数:12,代码来源:cosl.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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