//## Complex Complex.ccosf(); static KMETHOD Complex_ccosf(KonohaContext *kctx, KonohaStack *sfp) { kComplex *kc = (kComplex *) sfp[0].asObject; float _Complex zf = (float _Complex)kc->z; float ret = ccosf(zf); KReturnFloatValue(ret); }
// ellip_cdf() // // complex elliptic cd() function (Jacobian elliptic cosine) // // _u : vector in the complex u-plane // _k : elliptic modulus (0 <= _k < 1) // _n : number of Landen iterations (typically 5-6) float complex ellip_cdf(float complex _u, float _k, unsigned int _n) { float complex wn = ccosf(_u*M_PI*0.5f); float v[_n]; landenf(_k,_n,v); unsigned int i; for (i=_n; i>0; i--) { wn = (1 + v[i-1])*wn / (1 + v[i-1]*wn*wn); } return wn; }
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 }
void test2f(float x, float y) { if (-tanf(x-y) != tanf(y-x)) link_error (); if (-sinf(x-y) != sinf(y-x)) link_error (); if (cosf(-x*y) != cosf(x*y)) link_error (); if (cosf(x*-y) != cosf(x*y)) link_error (); if (cosf(-x/y) != cosf(x/y)) link_error (); if (cosf(x/-y) != cosf(x/y)) link_error (); if (cosf(-fabsf(tanf(x/-y))) != cosf(tanf(x/y))) link_error (); if (cosf(y<10 ? -x : y) != cosf(y<10 ? x : y)) link_error (); if (cosf(y<10 ? x : -y) != cosf(y<10 ? x : y)) link_error (); if (cosf(y<10 ? -fabsf(x) : tanf(x<20 ? -x : -fabsf(y))) != cosf(y<10 ? x : tanf(x<20 ? x : y))) link_error (); if (cosf((y*=3, -x)) != cosf((y*=3,x))) link_error (); if (cosf((y*=2, -fabsf(tanf(x/-y)))) != cosf((y*=2,tanf(x/y)))) link_error (); if (cosf(copysignf(x,y)) != cosf(x)) link_error (); if (cosf(copysignf(-fabsf(x),y*=2)) != cosf((y*=2,x))) link_error (); if (hypotf (x, 0) != fabsf(x)) link_error (); if (hypotf (0, x) != fabsf(x)) link_error (); if (hypotf (x, x) != fabsf(x) * __builtin_sqrtf(2)) link_error (); if (hypotf (-x, y) != hypotf (x, y)) link_error (); if (hypotf (x, -y) != hypotf (x, y)) link_error (); if (hypotf (-x, -y) != hypotf (x, y)) link_error (); if (hypotf (fabsf(x), y) != hypotf (x, y)) link_error (); if (hypotf (x, fabsf(y)) != hypotf (x, y)) link_error (); if (hypotf (fabsf(x), fabsf(y)) != hypotf (x, y)) link_error (); if (hypotf (-fabsf(-x), -fabsf(fabsf(fabsf(-y)))) != hypotf (x, y)) link_error (); if (hypotf (-x, 0) != fabsf(x)) link_error (); if (hypotf (-x, x) != fabsf(x) * __builtin_sqrtf(2)) link_error (); if (hypotf (puref(x), -puref(x)) != fabsf(puref(x)) * __builtin_sqrtf(2)) link_error (); if (hypotf (tanf(-x), tanf(-fabsf(y))) != hypotf (tanf(x), tanf(y))) link_error (); if (fminf (fmaxf(x,y),y) != y) link_error (); if (fminf (fmaxf(y,x),y) != y) link_error (); if (fminf (x,fmaxf(x,y)) != x) link_error (); if (fminf (x,fmaxf(y,x)) != x) link_error (); if (fmaxf (fminf(x,y),y) != y) link_error (); if (fmaxf (fminf(y,x),y) != y) link_error (); if (fmaxf (x,fminf(x,y)) != x) link_error (); if (fmaxf (x,fminf(y,x)) != x) link_error (); if ((__complex__ float) x != -(__complex__ float) (-x)) link_error (); if (x+(x-y)*1i != -(-x+(y-x)*1i)) link_error (); if (x+(x-y)*1i != -(-x-(x-y)*1i)) link_error (); if (ccosf(tanf(x)+sinf(y)*1i) != ccosf(-tanf(-x)+-sinf(-y)*1i)) link_error (); if (ccosf(tanf(x)+sinf(x-y)*1i) != ccosf(-tanf(-x)-sinf(y-x)*1i)) link_error (); if (-5+x*1i != -~(5+x*1i)) link_error (); if (tanf(x)+tanf(y)*1i != -~(tanf(-x)+tanf(y)*1i)) link_error (); }
TEST_RESOLVED(MIPS, "http://ellcc.org/bugzilla/show_bug.cgi?id=59") { TEST_TRACE(C99 7.3.5.1) d = cacos(d); f = cacosf(f); ld = cacosl(ld); TEST_TRACE(C99 7.3.5.2) d = casin(d); f = casinf(f); 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);
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, ccosf) { ASSERT_EQ(1.0, ccosf(0)); }