⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c99_functions.c

📁 gcc-fortran,linux使用fortran的编译软件。很好用的。
💻 C
📖 第 1 页 / 共 2 页
字号:
  a = REALPART (z);  b = IMAGPART (z);  COMPLEX_ASSIGN (v, cosl (b), sinl (b));  return expl (a) * v;}#endif/* log(z) = log (cabs(z)) + i*carg(z)  */#if !defined(HAVE_CLOGF)#define HAVE_CLOGF 1float complexclogf (float complex z){  float complex v;  COMPLEX_ASSIGN (v, logf (cabsf (z)), cargf (z));  return v;}#endif#if !defined(HAVE_CLOG)#define HAVE_CLOG 1double complexclog (double complex z){  double complex v;  COMPLEX_ASSIGN (v, log (cabs (z)), carg (z));  return v;}#endif#if !defined(HAVE_CLOGL) && defined(HAVE_LOGL) && defined(HAVE_CABSL) && defined(HAVE_CARGL)#define HAVE_CLOGL 1long double complexclogl (long double complex z){  long double complex v;  COMPLEX_ASSIGN (v, logl (cabsl (z)), cargl (z));  return v;}#endif/* log10(z) = log10 (cabs(z)) + i*carg(z)  */#if !defined(HAVE_CLOG10F)#define HAVE_CLOG10F 1float complexclog10f (float complex z){  float complex v;  COMPLEX_ASSIGN (v, log10f (cabsf (z)), cargf (z));  return v;}#endif#if !defined(HAVE_CLOG10)#define HAVE_CLOG10 1double complexclog10 (double complex z){  double complex v;  COMPLEX_ASSIGN (v, log10 (cabs (z)), carg (z));  return v;}#endif#if !defined(HAVE_CLOG10L) && defined(HAVE_LOG10L) && defined(HAVE_CABSL) && defined(HAVE_CARGL)#define HAVE_CLOG10L 1long double complexclog10l (long double complex z){  long double complex v;  COMPLEX_ASSIGN (v, log10l (cabsl (z)), cargl (z));  return v;}#endif/* pow(base, power) = cexp (power * clog (base))  */#if !defined(HAVE_CPOWF)#define HAVE_CPOWF 1float complexcpowf (float complex base, float complex power){  return cexpf (power * clogf (base));}#endif#if !defined(HAVE_CPOW)#define HAVE_CPOW 1double complexcpow (double complex base, double complex power){  return cexp (power * clog (base));}#endif#if !defined(HAVE_CPOWL) && defined(HAVE_CEXPL) && defined(HAVE_CLOGL)#define HAVE_CPOWL 1long double complexcpowl (long double complex base, long double complex power){  return cexpl (power * clogl (base));}#endif/* sqrt(z).  Algorithm pulled from glibc.  */#if !defined(HAVE_CSQRTF)#define HAVE_CSQRTF 1float complexcsqrtf (float complex z){  float re, im;  float complex v;  re = REALPART (z);  im = IMAGPART (z);  if (im == 0)    {      if (re < 0)        {          COMPLEX_ASSIGN (v, 0, copysignf (sqrtf (-re), im));        }      else        {          COMPLEX_ASSIGN (v, fabsf (sqrtf (re)), copysignf (0, im));        }    }  else if (re == 0)    {      float r;      r = sqrtf (0.5 * fabsf (im));      COMPLEX_ASSIGN (v, r, copysignf (r, im));    }  else    {      float d, r, s;      d = hypotf (re, im);      /* Use the identity   2  Re res  Im res = Im x         to avoid cancellation error in  d +/- Re x.  */      if (re > 0)        {          r = sqrtf (0.5 * d + 0.5 * re);          s = (0.5 * im) / r;        }      else        {          s = sqrtf (0.5 * d - 0.5 * re);          r = fabsf ((0.5 * im) / s);        }      COMPLEX_ASSIGN (v, r, copysignf (s, im));    }  return v;}#endif#if !defined(HAVE_CSQRT)#define HAVE_CSQRT 1double complexcsqrt (double complex z){  double re, im;  double complex v;  re = REALPART (z);  im = IMAGPART (z);  if (im == 0)    {      if (re < 0)        {          COMPLEX_ASSIGN (v, 0, copysign (sqrt (-re), im));        }      else        {          COMPLEX_ASSIGN (v, fabs (sqrt (re)), copysign (0, im));        }    }  else if (re == 0)    {      double r;      r = sqrt (0.5 * fabs (im));      COMPLEX_ASSIGN (v, r, copysign (r, im));    }  else    {      double d, r, s;      d = hypot (re, im);      /* Use the identity   2  Re res  Im res = Im x         to avoid cancellation error in  d +/- Re x.  */      if (re > 0)        {          r = sqrt (0.5 * d + 0.5 * re);          s = (0.5 * im) / r;        }      else        {          s = sqrt (0.5 * d - 0.5 * re);          r = fabs ((0.5 * im) / s);        }      COMPLEX_ASSIGN (v, r, copysign (s, im));    }  return v;}#endif#if !defined(HAVE_CSQRTL) && defined(HAVE_COPYSIGNL) && defined(HAVE_SQRTL) && defined(HAVE_FABSL) && defined(HAVE_HYPOTL)#define HAVE_CSQRTL 1long double complexcsqrtl (long double complex z){  long double re, im;  long double complex v;  re = REALPART (z);  im = IMAGPART (z);  if (im == 0)    {      if (re < 0)        {          COMPLEX_ASSIGN (v, 0, copysignl (sqrtl (-re), im));        }      else        {          COMPLEX_ASSIGN (v, fabsl (sqrtl (re)), copysignl (0, im));        }    }  else if (re == 0)    {      long double r;      r = sqrtl (0.5 * fabsl (im));      COMPLEX_ASSIGN (v, copysignl (r, im), r);    }  else    {      long double d, r, s;      d = hypotl (re, im);      /* Use the identity   2  Re res  Im res = Im x         to avoid cancellation error in  d +/- Re x.  */      if (re > 0)        {          r = sqrtl (0.5 * d + 0.5 * re);          s = (0.5 * im) / r;        }      else        {          s = sqrtl (0.5 * d - 0.5 * re);          r = fabsl ((0.5 * im) / s);        }      COMPLEX_ASSIGN (v, r, copysignl (s, im));    }  return v;}#endif/* sinh(a + i b) = sinh(a) cos(b) + i cosh(a) sin(b)  */#if !defined(HAVE_CSINHF)#define HAVE_CSINHF 1float complexcsinhf (float complex a){  float r, i;  float complex v;  r = REALPART (a);  i = IMAGPART (a);  COMPLEX_ASSIGN (v, sinhf (r) * cosf (i), coshf (r) * sinf (i));  return v;}#endif#if !defined(HAVE_CSINH)#define HAVE_CSINH 1double complexcsinh (double complex a){  double r, i;  double complex v;  r = REALPART (a);  i = IMAGPART (a);  COMPLEX_ASSIGN (v, sinh (r) * cos (i), cosh (r) * sin (i));  return v;}#endif#if !defined(HAVE_CSINHL) && defined(HAVE_COSL) && defined(HAVE_COSHL) && defined(HAVE_SINL) && defined(HAVE_SINHL)#define HAVE_CSINHL 1long double complexcsinhl (long double complex a){  long double r, i;  long double complex v;  r = REALPART (a);  i = IMAGPART (a);  COMPLEX_ASSIGN (v, sinhl (r) * cosl (i), coshl (r) * sinl (i));  return v;}#endif/* cosh(a + i b) = cosh(a) cos(b) - i sinh(a) sin(b)  */#if !defined(HAVE_CCOSHF)#define HAVE_CCOSHF 1float complexccoshf (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;}#endif#if !defined(HAVE_CCOSH)#define HAVE_CCOSH 1double complexccosh (double complex a){  double r, i;  double complex v;  r = REALPART (a);  i = IMAGPART (a);  COMPLEX_ASSIGN (v, cosh (r) * cos (i), - (sinh (r) * sin (i)));  return v;}#endif#if !defined(HAVE_CCOSHL) && defined(HAVE_COSL) && defined(HAVE_COSHL) && defined(HAVE_SINL) && defined(HAVE_SINHL)#define HAVE_CCOSHL 1long double complexccoshl (long double complex a){  long double r, i;  long double complex v;  r = REALPART (a);  i = IMAGPART (a);  COMPLEX_ASSIGN (v, coshl (r) * cosl (i), - (sinhl (r) * sinl (i)));  return v;}#endif/* tanh(a + i b) = (tanh(a) + i tan(b)) / (1 - i tanh(a) tan(b))  */#if !defined(HAVE_CTANHF)#define HAVE_CTANHF 1float complexctanhf (float complex a){  float rt, it;  float complex n, d;  rt = tanhf (REALPART (a));  it = tanf (IMAGPART (a));  COMPLEX_ASSIGN (n, rt, it);  COMPLEX_ASSIGN (d, 1, - (rt * it));  return n / d;}#endif#if !defined(HAVE_CTANH)#define HAVE_CTANH 1double complexctanh (double complex a){  double rt, it;  double complex n, d;  rt = tanh (REALPART (a));  it = tan (IMAGPART (a));  COMPLEX_ASSIGN (n, rt, it);  COMPLEX_ASSIGN (d, 1, - (rt * it));  return n / d;}#endif#if !defined(HAVE_CTANHL) && defined(HAVE_TANL) && defined(HAVE_TANHL)#define HAVE_CTANHL 1long double complexctanhl (long double complex a){  long double rt, it;  long double complex n, d;  rt = tanhl (REALPART (a));  it = tanl (IMAGPART (a));  COMPLEX_ASSIGN (n, rt, it);  COMPLEX_ASSIGN (d, 1, - (rt * it));  return n / d;}#endif/* sin(a + i b) = sin(a) cosh(b) + i cos(a) sinh(b)  */#if !defined(HAVE_CSINF)#define HAVE_CSINF 1float complexcsinf (float complex a){  float r, i;  float complex v;  r = REALPART (a);  i = IMAGPART (a);  COMPLEX_ASSIGN (v, sinf (r) * coshf (i), cosf (r) * sinhf (i));  return v;}#endif#if !defined(HAVE_CSIN)#define HAVE_CSIN 1double complexcsin (double complex a){  double r, i;  double complex v;  r = REALPART (a);  i = IMAGPART (a);  COMPLEX_ASSIGN (v, sin (r) * cosh (i), cos (r) * sinh (i));  return v;}#endif#if !defined(HAVE_CSINL) && defined(HAVE_COSL) && defined(HAVE_COSHL) && defined(HAVE_SINL) && defined(HAVE_SINHL)#define HAVE_CSINL 1long double complexcsinl (long double complex a){  long double r, i;  long double complex v;  r = REALPART (a);  i = IMAGPART (a);  COMPLEX_ASSIGN (v, sinl (r) * coshl (i), cosl (r) * sinhl (i));  return v;}#endif/* cos(a + i b) = cos(a) cosh(b) - i sin(a) sinh(b)  */#if !defined(HAVE_CCOSF)#define HAVE_CCOSF 1float complexccosf (float complex a){  float r, i;  float complex v;  r = REALPART (a);  i = IMAGPART (a);  COMPLEX_ASSIGN (v, cosf (r) * coshf (i), - (sinf (r) * sinhf (i)));  return v;}#endif#if !defined(HAVE_CCOS)#define HAVE_CCOS 1double complexccos (double complex a){  double r, i;  double complex v;  r = REALPART (a);  i = IMAGPART (a);  COMPLEX_ASSIGN (v, cos (r) * cosh (i), - (sin (r) * sinh (i)));  return v;}#endif#if !defined(HAVE_CCOSL) && defined(HAVE_COSL) && defined(HAVE_COSHL) && defined(HAVE_SINL) && defined(HAVE_SINHL)#define HAVE_CCOSL 1long double complexccosl (long double complex a){  long double r, i;  long double complex v;  r = REALPART (a);  i = IMAGPART (a);  COMPLEX_ASSIGN (v, cosl (r) * coshl (i), - (sinl (r) * sinhl (i)));  return v;}#endif/* tan(a + i b) = (tan(a) + i tanh(b)) / (1 - i tan(a) tanh(b))  */#if !defined(HAVE_CTANF)#define HAVE_CTANF 1float complexctanf (float complex a){  float rt, it;  float complex n, d;  rt = tanf (REALPART (a));  it = tanhf (IMAGPART (a));  COMPLEX_ASSIGN (n, rt, it);  COMPLEX_ASSIGN (d, 1, - (rt * it));  return n / d;}#endif#if !defined(HAVE_CTAN)#define HAVE_CTAN 1double complexctan (double complex a){  double rt, it;  double complex n, d;  rt = tan (REALPART (a));  it = tanh (IMAGPART (a));  COMPLEX_ASSIGN (n, rt, it);  COMPLEX_ASSIGN (d, 1, - (rt * it));  return n / d;}#endif#if !defined(HAVE_CTANL) && defined(HAVE_TANL) && defined(HAVE_TANHL)#define HAVE_CTANL 1long double complexctanl (long double complex a){  long double rt, it;  long double complex n, d;  rt = tanl (REALPART (a));  it = tanhl (IMAGPART (a));  COMPLEX_ASSIGN (n, rt, it);  COMPLEX_ASSIGN (d, 1, - (rt * it));  return n / d;}#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -