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

C++ sinhf函数代码示例

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

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



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

示例1: csinhf

float complex
csinhf(float complex z)
{
	float x, y, h;
	int32_t hx, hy, ix, iy;

	x = crealf(z);
	y = cimagf(z);

	GET_FLOAT_WORD(hx, x);
	GET_FLOAT_WORD(hy, y);

	ix = 0x7fffffff & hx;
	iy = 0x7fffffff & hy;

	if (ix < 0x7f800000 && iy < 0x7f800000) {
		if (iy == 0)
			return (cpackf(sinhf(x), y));
		if (ix < 0x41100000)	/* small x: normal case */
			return (cpackf(sinhf(x) * cosf(y), coshf(x) * sinf(y)));

		/* |x| >= 9, so cosh(x) ~= exp(|x|) */
		if (ix < 0x42b17218) {
			/* x < 88.7: expf(|x|) won't overflow */
			h = expf(fabsf(x)) * 0.5f;
			return (cpackf(copysignf(h, x) * cosf(y), h * sinf(y)));
		} else if (ix < 0x4340b1e7) {
			/* x < 192.7: scale to avoid overflow */
			z = __ldexp_cexpf(cpackf(fabsf(x), y), -1);
			return (cpackf(crealf(z) * copysignf(1, x), cimagf(z)));
		} else {
			/* x >= 192.7: the result always overflows */
			h = huge * x;
			return (cpackf(h * cosf(y), h * h * sinf(y)));
		}
	}

	if (ix == 0 && iy >= 0x7f800000)
		return (cpackf(copysignf(0, x * (y - y)), y - y));

	if (iy == 0 && ix >= 0x7f800000) {
		if ((hx & 0x7fffff) == 0)
			return (cpackf(x, y));
		return (cpackf(x, copysignf(0, y)));
	}

	if (ix < 0x7f800000 && iy >= 0x7f800000)
		return (cpackf(y - y, x * (y - y)));

	if (ix >= 0x7f800000 && (hx & 0x7fffff) == 0) {
		if (iy >= 0x7f800000)
			return (cpackf(x * x, x * (y - y)));
		return (cpackf(x * cosf(y), INFINITY * sinf(y)));
	}

	return (cpackf((x * x) * (y - y), (x + x) * (y - y)));
}
开发者ID:MattDooner,项目名称:freebsd-west,代码行数:57,代码来源:s_csinhf.c


示例2: kepler

static float
kepler(const float ecc, float mean_anom)
{
	float curr, err, thresh;
	int is_negative = 0, n_iter = 0;

	if( !mean_anom) {
		return( 0.);
	}

	if( ecc < .3) {   /* low-eccentricity formula from Meeus,  p. 195 */
		curr = atan2f( sinf( mean_anom), cosf( mean_anom) - ecc);
			/* one correction step,  and we're done */
		err = curr - ecc * sinf( curr) - mean_anom;
		curr -= err / (1. - ecc * cosf( curr));
	} else {
	    curr = mean_anom;
	}

	if( mean_anom < 0.) {
		mean_anom = -mean_anom;
		curr = - curr;
		is_negative = 1;
	}

	thresh = THRESH * fabsf( 1. - ecc);
	if( ecc > .8 && mean_anom < PI / 3. || ecc > 1.)    /* up to 60 degrees */ {
		float trial = mean_anom / fabsf( 1. - ecc);

		if( trial * trial > 6. * fabsf(1. - ecc))   /* cubic term is dominant */ {
			if( mean_anom < PI) {
				trial = CUBE_ROOT( 6. * mean_anom);
			} else {      /* hyperbolic w/ 5th & higher-order terms predominant */
				trial = asinhf( mean_anom / ecc);
			}
		}
		curr = trial;
	}

	if( ecc < 1.) {
		err = curr - ecc * sinf( curr) - mean_anom;
		while( fabsf( err) > thresh) {
			n_iter++;
			curr -= err / (1. - ecc * cosf( curr));
			err = curr - ecc * sinf( curr) - mean_anom;
		}
	} else {
		err = ecc * sinhf( curr) - curr - mean_anom;
		while( fabsf( err) > thresh) {
			n_iter++;
			curr -= err / (ecc * coshf( curr) - 1.);
			err = ecc * sinhf( curr) - curr - mean_anom;
		}
	}
	return( is_negative ? -curr : curr);
}
开发者ID:revarbat,项目名称:CLIVE,代码行数:56,代码来源:celestial.cpp


示例3: ATF_TC_BODY

ATF_TC_BODY(sinhf_nan, tc)
{
	const float x = 0.0L / 0.0L;

	ATF_CHECK(isnan(x) != 0);
	ATF_CHECK(isnan(sinhf(x)) != 0);
}
开发者ID:2asoft,项目名称:freebsd,代码行数:7,代码来源:t_sinh.c


示例4: sinhf_cmd

static TACommandVerdict sinhf_cmd(TAThread thread,TAInputStream stream)
{
    float x, res;

    // Prepare

    x = readFloat(&stream);
    errno = 0;
    
    START_TARGET_OPERATION(thread);
    
    // Execute

    res = sinhf(x);
    
    END_TARGET_OPERATION(thread);
    
    // Response
    
    writeFloat(thread, res);
    writeInt(thread, errno);

    sendResponse(thread);
    return taDefaultVerdict;
}
开发者ID:levenkov,项目名称:olver,代码行数:25,代码来源:hyper_agent.c


示例5: performMathsOp

/**
 * Performs some maths operation
 */
static void performMathsOp(struct core_ctrl * core) {
	if (core->core_command-1000 == RANDOM_MATHS_OP) {
		core->data[0]=INT_TYPE;
		int r=rand();
		memcpy(&core->data[1], &r, sizeof(int));
	} else {
		float fvalue=0.0, r=0.0;
		if (core->data[0]==1) {
			fvalue=*((float*) &core->data[1]);
		} else if (core->data[0]==0) {
			fvalue=(float) *((int*) &core->data[1]);
		}
		if (core->core_command-1000 == SQRT_MATHS_OP) r=sqrtf(fvalue);
		if (core->core_command-1000 == SIN_MATHS_OP) r=sinf(fvalue);
		if (core->core_command-1000 == COS_MATHS_OP) r=cosf(fvalue);
		if (core->core_command-1000 == TAN_MATHS_OP) r=tanf(fvalue);
		if (core->core_command-1000 == ASIN_MATHS_OP) r=asinf(fvalue);
		if (core->core_command-1000 == ACOS_MATHS_OP) r=acosf(fvalue);
		if (core->core_command-1000 == ATAN_MATHS_OP) r=atanf(fvalue);
		if (core->core_command-1000 == SINH_MATHS_OP) r=sinhf(fvalue);
		if (core->core_command-1000 == COSH_MATHS_OP) r=coshf(fvalue);
		if (core->core_command-1000 == TANH_MATHS_OP) r=tanhf(fvalue);
		if (core->core_command-1000 == FLOOR_MATHS_OP) r=floorf(fvalue);
		if (core->core_command-1000 == CEIL_MATHS_OP) r=ceilf(fvalue);
		if (core->core_command-1000 == LOG_MATHS_OP) r=logf(fvalue);
		if (core->core_command-1000 == LOG10_MATHS_OP) r=log10f(fvalue);
		core->data[0]=REAL_TYPE;
		memcpy(&core->data[1], &r, sizeof(float));
	}
}
开发者ID:philipz,项目名称:epython,代码行数:33,代码来源:device-support.c


示例6: ctanhf

float complex ctanhf(float complex z)
{
	float x, y;
	float t, beta, s, rho, denom;
	uint32_t hx, ix;

	x = crealf(z);
	y = cimagf(z);

	GET_FLOAT_WORD(hx, x);
	ix = hx & 0x7fffffff;

	if (ix >= 0x7f800000) {
		if (ix & 0x7fffff)
			return CMPLXF(x, (y == 0 ? y : x * y));
		SET_FLOAT_WORD(x, hx - 0x40000000);
		return CMPLXF(x, copysignf(0, isinf(y) ? y : sinf(y) * cosf(y)));
	}

	if (!isfinite(y))
		return CMPLXF(y - y, y - y);

	if (ix >= 0x41300000) { /* x >= 11 */
		float exp_mx = expf(-fabsf(x));
		return CMPLXF(copysignf(1, x), 4 * sinf(y) * cosf(y) * exp_mx * exp_mx);
	}

	t = tanf(y);
	beta = 1.0 + t * t;
	s = sinhf(x);
	rho = sqrtf(1 + s * s);
	denom = 1 + beta * s * s;
	return CMPLXF((beta * rho * s) / denom, t / denom);
}
开发者ID:4ian,项目名称:emscripten,代码行数:34,代码来源:ctanhf.c


示例7: csinf

float complex csinf (float complex Z)
{
  float complex Res;
  __real__ Res = sinf (__real__ Z) * coshf ( __imag__ Z);
  __imag__ Res = cosf (__real__ Z) * sinhf ( __imag__ Z);
  return Res;
}
开发者ID:MiUishadow,项目名称:binutils,代码行数:7,代码来源:csinf.c


示例8: utm_of_lla_f

/* Convert lla to utm (float).
 * Note this conversion is not very accurate. If high accuracy needed use lla_of_utm_d.
 * @param[out] utm position in m, alt is copied directly from lla
 * @param[in]  lla position in rad, alt in m
 */
void utm_of_lla_f(struct UtmCoor_f *utm, struct LlaCoor_f *lla)
{
  // compute zone if not initialised
  if (utm->zone == 0) {
    utm->zone = UtmZoneOfLlaLonRad(lla->lon);
  }

  float lambda_c = LambdaOfUtmZone(utm->zone);
  float ll = isometric_latitude_f(lla->lat , E);
  float dl = lla->lon - lambda_c;
  float phi_ = asinf(sinf(dl) / coshf(ll));
  float ll_ = isometric_latitude_fast_f(phi_);
  float lambda_ = atanf(sinhf(ll) / cosf(dl));
  struct complex z_ = { lambda_,  ll_ };
  CScal(serie_coeff_proj_mercator[0], z_);
  int8_t k;
  for (k = 1; k < 3; k++) {
    struct complex z = { lambda_, ll_ };
    CScal(2.*k, z);
    CSin(z);
    CScal(serie_coeff_proj_mercator[k], z);
    CAdd(z, z_);
  }
  CScal(N, z_);
  utm->east = DELTA_EAST + z_.im;
  utm->north = DELTA_NORTH + z_.re;

  // copy alt above reference ellipsoid
  utm->alt = lla->alt;
}
开发者ID:EwoudSmeur,项目名称:paparazzi,代码行数:35,代码来源:pprz_geodetic_float.c


示例9: CLANG_PORT_DECL

float complex CLANG_PORT_DECL(ccoshf) (float complex Z)
{
  float complex Res;
  __real__ Res = coshf (__real__ Z) * cosf (__imag__ Z);
  __imag__ Res = sinhf (__real__ Z) * sinf (__imag__ Z);
  return Res;
}
开发者ID:maeikei,项目名称:port-rt,代码行数:7,代码来源:ccoshf.c


示例10: lla_of_utm_f

/* Convert utm to lla (float).
 * Note this conversion is not very accurate. If high accuracy needed use lla_of_utm_d.
 * @param[out] lla position in rad, alt is copied directly from utm
 * @param[in]  utm position in m, alt in m
 */
void lla_of_utm_f(struct LlaCoor_f *lla, struct UtmCoor_f *utm)
{
  float scale = 1 / N / serie_coeff_proj_mercator[0];
  float real = (utm->north - DELTA_NORTH) * scale;
  float img = (utm->east - DELTA_EAST) * scale;
  struct complex z = { real, img };

  int8_t k;
  for (k = 1; k < 2; k++) {
    struct complex z_ = { real, img };
    CScal(2.*k, z_);
    CSin(z_);
    CScal(serie_coeff_proj_mercator_inverse[k], z_);
    CSub(z_, z);
  }

  float lambda_c = LambdaOfUtmZone(utm->zone);
  lla->lon = lambda_c + atanf(sinhf(z.im) / cosf(z.re));
  float phi_ = asinf(sinf(z.re) / coshf(z.im));
  float il = isometric_latitude_fast_f(phi_);
  lla->lat = inverse_isometric_latitude_f(il, E, 1e-8);

  // copy alt above reference ellipsoid
  lla->alt = utm->alt;
}
开发者ID:EwoudSmeur,项目名称:paparazzi,代码行数:30,代码来源:pprz_geodetic_float.c


示例11: test_sinh

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


示例12: performMathsOp

/**
 * Called when running on the host, this performs some maths operation
 */
struct value_defn performMathsOp(unsigned short operation, struct value_defn value) {
	struct value_defn result;
	result.dtype=SCALAR;
	if (operation== RANDOM_MATHS_OP) {
		result.type=INT_TYPE;
		int r=rand();
		cpy(result.data, &r, sizeof(int));
	} else {
		float fvalue, r;
		if (value.type==REAL_TYPE) {
			fvalue=*((float*) value.data);
		} else if (value.type==INT_TYPE) {
			fvalue=(float) *((int*) value.data);
		}
		result.type=REAL_TYPE;
		if (operation==SQRT_MATHS_OP) r=sqrtf(fvalue);
		if (operation==SIN_MATHS_OP) r=sinf(fvalue);
		if (operation==COS_MATHS_OP) r=cosf(fvalue);
		if (operation==TAN_MATHS_OP) r=tanf(fvalue);
		if (operation==ASIN_MATHS_OP) r=asinf(fvalue);
		if (operation==ACOS_MATHS_OP) r=acosf(fvalue);
		if (operation==ATAN_MATHS_OP) r=atanf(fvalue);
		if (operation==SINH_MATHS_OP) r=sinhf(fvalue);
		if (operation==COSH_MATHS_OP) r=coshf(fvalue);
		if (operation==TANH_MATHS_OP) r=tanhf(fvalue);
		if (operation==FLOOR_MATHS_OP) r=floorf(fvalue);
		if (operation==CEIL_MATHS_OP) r=ceilf(fvalue);
		if (operation==LOG_MATHS_OP) r=logf(fvalue);
		if (operation==LOG10_MATHS_OP) r=log10f(fvalue);
		cpy(result.data, &r, sizeof(float));
	}
	return result;
}
开发者ID:caidongyun,项目名称:epython,代码行数:36,代码来源:host-functions.c


示例13: ctanf

float complex ctanf (float complex Z)
{
  float complex Res;
  float two_I = 2.0f * __imag__ Z;
  float two_R = 2.0f * __real__ Z;
  float denom = cosf (two_R) + coshf (two_I);
  if (denom == 0.0f)
    {
      errno = ERANGE;
      __real__ Res = HUGE_VALF;
      __imag__ Res = HUGE_VALF;
    }
  else if (isinf (denom))
    {
      errno = ERANGE;
      __real__ Res = 0.0;
      __imag__ Res = two_I > 0 ? 1.0f : -1.0f;
    }
  else
    {
      __real__ Res = sinf (two_R) / denom;
      __imag__ Res = sinhf (two_I) / denom;
    }
  return Res;
}
开发者ID:mirror,项目名称:mingw-org-wsl,代码行数:25,代码来源:ctanf.c


示例14: sinhf

static void *sinh_new(t_floatarg f)
{
    t_sinh *x = (t_sinh *)pd_new(sinh_class);
    /* CHECKME large values */
    x->x_value = sinhf(f);
    outlet_new((t_object *)x, &s_float);
    return (x);
}
开发者ID:EQ4,项目名称:Pd-for-LibPd,代码行数:8,代码来源:sinh.c


示例15: __ccos

complex __ccos(float zreal, float zimag)
{
  complex r;

  r.real = cosf(zreal) * coshf(zimag);
  r.imag = - sinf(zreal) * sinhf(zimag);
  return r;
}
开发者ID:manojxantony,项目名称:compiler,代码行数:8,代码来源:c_cos.c


示例16: csinhf

float complex
csinhf(float complex z)
{
	float complex w;
	float x, y;

	x = crealf(z);
	y = cimagf(z);
	w = sinhf (x) * cosf (y)  +  (coshf (x) * sinf (y)) * I;
	return (w);
}
开发者ID:Ninals-GitHub,项目名称:TRON,代码行数:11,代码来源:s_csinhf.c


示例17: ccoshf

float complex
ccoshf (float complex a)
{
  float r, i;
  float complex v;

  r = REALPART (a);
  i = IMAGPART (a);
  COMPLEX_ASSIGN (v, coshf (r) * cosf (i), - (sinhf (r) * sinf (i)));
  return v;
}
开发者ID:5432935,项目名称:crossbridge,代码行数:11,代码来源:c99_functions.c


示例18: ccoshf

float complex
ccoshf(float complex z)
{
	float complex w;
	float x, y;

	x = creal(z);
	y = cimag(z);
	w = coshf (x) * cosf (y)  +  (sinhf (x) * sinf (y)) * I;
	return (w);
}
开发者ID:mikekmv,项目名称:aeriebsd-src,代码行数:11,代码来源:s_ccoshf.c


示例19: ctanhf

float complex
ctanhf(float complex z)
{
	float complex w;
	float x, y, d;

	x = crealf(z);
	y = cimagf(z);
	d = coshf (2.0f * x) + cosf (2.0f * y);
	w = sinhf (2.0f * x) / d  +  (sinf (2.0f * y) / d) * I;
	return (w);
}
开发者ID:Ninals-GitHub,项目名称:TRON,代码行数:12,代码来源:s_ctanhf.c


示例20: ccoshf

/* cosh(z) = cosh(a)cos(b) - isinh(a)sin(b)  */
GFC_COMPLEX_4
ccoshf (GFC_COMPLEX_4 a)
{
  GFC_REAL_4 r;
  GFC_REAL_4 i;
  GFC_COMPLEX_4 v;

  r = REALPART (a);
  i = IMAGPART (a);
  COMPLEX_ASSIGN (v, coshf (r) * cosf (i), - (sinhf (r) * sinf (i)));
  return v;
}
开发者ID:BackupTheBerlios,项目名称:iphone-binutils-svn,代码行数:13,代码来源:hyp_c4.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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