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


C++ sinl函数代码示例

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


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

示例1: tt_to_tdbl

long double tt_to_tdbl(long double tt)
{
    long double d = (tt - MJD2000) / JULIAN_C;
    long double g = GRAD_IN_RAD * (357.258 + 35999.050 * d);
    return tt + ((0.00168 * sinl(g + 0.0167*sinl(g))) / 86400.0);

//    long double mjd = utc_to_mjdl(2003, 3, 7, 2, 45, 0.0);
//    long double t = (mjd + 2400000.5 - 2451545.0) / 36525.0;
//    long double dtr = M_PI / 180;
//    long double corr;
//    corr = 1656.675     * sin(dtr * (35999.3729 * t + 357.5287))
//           + 22.418     * sin(dtr * (32964.467  * t + 246.199))
//           + 13.84      * sin(dtr * (71998.746  * t + 355.057))
//           +  4.77      * sin(dtr * ( 3034.906  * t +  25.463))
//           +  4.677     * sin(dtr * (34777.259  * t + 230.394))
//           + 10.216 * t * sin(dtr * (35999.373  * t + 243.451))
//           +  0.171 * t * sin(dtr * (71998.746  * t + 240.98 ))
//           +  0.027 * t * sin(dtr * ( 1222.114  * t + 194.661))
//           +  0.027 * t * sin(dtr * ( 3034.906  * t + 336.061))
//           +  0.026 * t * sin(dtr * (  -20.186  * t +   9.382))
//           +  0.007 * t * sin(dtr * (29929.562  * t + 264.911))
//           +  0.006 * t * sin(dtr * (  150.678  * t +  59.775))
//           +  0.005 * t * sin(dtr * ( 9037.513  * t + 256.025))
//           +  0.043 * t * sin(dtr * (35999.373  * t + 151.121));
//
//    return tt + (0.000001 * corr / 86400.0);
}
开发者ID:unmade,项目名称:satellite-position,代码行数:27,代码来源:date_converters.c

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: main

int main(void)
{
	#pragma STDC FENV_ACCESS ON
	long double y;
	float d;
	int e, i, err = 0;
	struct l_l *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 = sinl(p->x);
		e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);

		if (!checkexcept(e, p->e, p->r)) {
			printf("%s:%d: bad fp exception: %s sinl(%La)=%La, want %s",
				p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
			printf(" got %s\n", estr(e));
			err++;
		}
		d = ulperrl(y, p->y, p->dy);
		if (!checkulp(d, p->r)) {
			printf("%s:%d: %s sinl(%La) want %La got %La 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,代码来源:sinl.c

示例7: _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

示例8: 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

示例9: 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

示例10: cm_float_sin

void
cm_float_sin(unsigned argc, obj_t args)
{
  obj_t recvr = CAR(args);

  m_float_new(consts.cl._float, sinl(FLOAT(recvr)->val));
}
开发者ID:hpersh,项目名称:ool2,代码行数:7,代码来源:math.c

示例11: 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

示例12: 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

示例13: _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

示例14: _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

示例15: _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


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