Example #1
0
//## Complex Complex.ctanf();
static KMETHOD Complex_ctanf(KonohaContext *kctx, KonohaStack *sfp)
{
	kComplex *kc = (kComplex *) sfp[0].asObject;
	float _Complex zf = (float _Complex)kc->z;
	float ret = ctanf(zf);
	KReturnFloatValue(ret);
}
void test3f(__complex__ float x, __complex__ float y, int i)
{
  if (ccosf(x) != ccosf(-x))
    link_error();

  if (ccosf(ctanf(x)) != ccosf(ctanf(-x)))
    link_error();

  if (ctanf(x-y) != -ctanf(y-x))
    link_error();

  if (ccosf(x/y) != ccosf(-x/y))
    link_error();

  if (ccosf(x/y) != ccosf(x/-y))
    link_error();

  if (ccosf(x/ctanf(y)) != ccosf(-x/ctanf(-y)))
    link_error();

  if (ccosf(x*y) != ccosf(-x*y))
    link_error();

  if (ccosf(x*y) != ccosf(x*-y))
    link_error();

  if (ccosf(ctanf(x)*y) != ccosf(ctanf(-x)*-y))
    link_error();

  if (ccosf(ctanf(x/y)) != ccosf(-ctanf(x/-y)))
    link_error();

  if (ccosf(i ? x : y) != ccosf(i ? -x : y))
    link_error();

  if (ccosf(i ? x : y) != ccosf(i ? x : -y))
    link_error();

  if (ccosf(i ? x : ctanf(y/x)) != ccosf(i ? -x : -ctanf(-y/x)))
    link_error();

  if (~x != -~-x)
    link_error();

  if (ccosf(~x) != ccosf(-~-x))
    link_error();

  if (ctanf(~(x-y)) != -ctanf(~(y-x)))
    link_error();

  if (ctanf(~(x/y)) != -ctanf(~(x/-y)))
    link_error();

#ifdef HAVE_C99_RUNTIME
  if (cargf(x) != atan2f(__imag__ x, __real__ x))
    link_error ();
#endif
}
Example #3
0
 ld = casinl(ld);
 TEST_TRACE(C99 7.3.5.3)
 d = catan(d);
 f = catanf(f);
 ld = catanl(ld);
 TEST_TRACE(C99 7.3.5.4)
 d = ccos(d);
 f = ccosf(f);
 ld = ccosl(ld);
 TEST_TRACE(C99 7.3.5.5)
 d = csin(d);
 f = csinf(f);
 ld = csinl(ld);
 TEST_TRACE(C99 7.3.5.6)
 d = ctan(d);
 f = ctanf(f);
 ld = ctanl(ld);
 TEST_TRACE(C99 7.3.6.1)
 d = cacosh(d);
 f = cacoshf(f);
 ld = cacoshl(ld);
 TEST_TRACE(C99 7.3.6.2)
 d = casinh(d);
 f = casinhf(f);
 ld = casinhl(ld);
 TEST_TRACE(C99 7.3.6.3)
 d = catanh(d);
 f = catanhf(f);
 ld = catanhl(ld);
 TEST_TRACE(C99 7.3.6.4)
 d = ccosh(d);
Example #4
0
void
docomplexf (void)
{
#ifndef NO_FLOAT
  complex float ca, cb, cc;
  float f1;

  ca = 1.0 + 1.0 * I;
  cb = 1.0 - 1.0 * I;

  f1 = cabsf (ca);
  fprintf (stdout, "cabsf  : %f\n", f1);

  cc = cacosf (ca);
  fprintf (stdout, "cacosf : %f %fi\n", crealf (cc),
	   cimagf (cc));

  cc = cacoshf (ca);
  fprintf (stdout, "cacoshf: %f %fi\n", crealf (cc),
	   cimagf (cc));

  f1 = cargf (ca);
  fprintf (stdout, "cargf  : %f\n", f1);

  cc = casinf (ca);
  fprintf (stdout, "casinf : %f %fi\n", crealf (cc),
	   cimagf (cc));

  cc = casinhf (ca);
  fprintf (stdout, "casinhf: %f %fi\n", crealf (cc),
	   cimagf (cc));

  cc = catanf (ca);
  fprintf (stdout, "catanf : %f %fi\n", crealf (cc),
	   cimagf (cc));

  cc = catanhf (ca);
  fprintf (stdout, "catanhf: %f %fi\n", crealf (cc),
	   cimagf (cc));

  cc = ccosf (ca);
  fprintf (stdout, "ccosf  : %f %fi\n", crealf (cc),
	   cimagf (cc));

  cc = ccoshf (ca);
  fprintf (stdout, "ccoshf : %f %fi\n", crealf (cc),
	   cimagf (cc));

  cc = cexpf (ca);
  fprintf (stdout, "cexpf  : %f %fi\n", crealf (cc),
	   cimagf (cc));

  f1 = cimagf (ca);
  fprintf (stdout, "cimagf : %f\n", f1);

  cc = clogf (ca);
  fprintf (stdout, "clogf  : %f %fi\n", crealf (cc),
	   cimagf (cc));

  cc = conjf (ca);
  fprintf (stdout, "conjf  : %f %fi\n", crealf (cc),
	   cimagf (cc));

  cc = cpowf (ca, cb);
  fprintf (stdout, "cpowf  : %f %fi\n", crealf (cc),
	   cimagf (cc));

  cc = cprojf (ca);
  fprintf (stdout, "cprojf : %f %fi\n", crealf (cc),
	   cimagf (cc));

  f1 = crealf (ca);
  fprintf (stdout, "crealf : %f\n", f1);

  cc = csinf (ca);
  fprintf (stdout, "csinf  : %f %fi\n", crealf (cc),
	   cimagf (cc));

  cc = csinhf (ca);
  fprintf (stdout, "csinhf : %f %fi\n", crealf (cc),
	   cimagf (cc));

  cc = csqrtf (ca);
  fprintf (stdout, "csqrtf : %f %fi\n", crealf (cc),
	   cimagf (cc));

  cc = ctanf (ca);
  fprintf (stdout, "ctanf  : %f %fi\n", crealf (cc),
	   cimagf (cc));

  cc = ctanhf (ca);
  fprintf (stdout, "ctanhf : %f %fi\n", crealf (cc),
	   cimagf (cc));
#endif
}
TEST(complex, ctanf) {
  ASSERT_EQ(0.0, ctanf(0));
}