long double complex cprojl(long double complex z) { if (isinf(creall(z)) || isinf(cimagl(z))) return cpackl(INFINITY, copysignl(0.0, creall(z))); return z; }
long double complex conjl(long double complex z) { return CMPLXL(creall(z), -cimagl(z)); }
long double complex cacosl(long double complex z) { z = casinl(z); return CMPLXL(PI_2 - creall(z), -cimagl(z)); }
long double complex ccosl(long double complex z) { return ccoshl(CMPLXL(-cimagl(z), creall(z))); }
DLLEXPORT long double complex csqrtl(long double complex z) { long double complex result; long double a, b; long double t; int scale; a = creall(z); b = cimagl(z); /* Handle special cases. */ if (z == 0) return (CMPLXL(0, b)); if (isinf(b)) return (CMPLXL(INFINITY, b)); if (isnan(a)) { t = (b - b) / (b - b); /* raise invalid if b is not a NaN */ return (CMPLXL(a, t)); /* return NaN + NaN i */ } if (isinf(a)) { /* * csqrt(inf + NaN i) = inf + NaN i * csqrt(inf + y i) = inf + 0 i * csqrt(-inf + NaN i) = NaN +- inf i * csqrt(-inf + y i) = 0 + inf i */ if (signbit(a)) return (CMPLXL(fabsl(b - b), copysignl(a, b))); else return (CMPLXL(a, copysignl(b - b, b))); } /* * The remaining special case (b is NaN) is handled just fine by * the normal code path below. */ /* Scale to avoid overflow. */ if (fabsl(a) >= THRESH || fabsl(b) >= THRESH) { a *= 0.25; b *= 0.25; scale = 1; } else { scale = 0; } /* Algorithm 312, CACM vol 10, Oct 1967. */ if (a >= 0) { t = sqrtl((a + hypotl(a, b)) * 0.5); result = CMPLXL(t, b / (2 * t)); } else { t = sqrtl((-a + hypotl(a, b)) * 0.5); result = CMPLXL(fabsl(b) / (2 * t), copysignl(t, b)); } /* Rescale. */ if (scale) return (result * 2); else return (result); }
int main (void) { /* For each type, test both runtime and compile time (constant folding) optimization. */ volatile float _Complex fc = 1.0F + 2.0iF; volatile double _Complex dc = 1.0 + 2.0i; volatile long double _Complex ldc = 1.0L + 2.0iL; /* Test floats. */ if (conjf (fc) != 1.0F - 2.0iF) abort (); if (__builtin_conjf (fc) != 1.0F - 2.0iF) abort (); if (conjf (1.0F + 2.0iF) != 1.0F - 2.0iF) link_failure (); if (__builtin_conjf (1.0F + 2.0iF) != 1.0F - 2.0iF) link_failure (); if (crealf (fc) != 1.0F) abort (); if (__builtin_crealf (fc) != 1.0F) abort (); if (crealf (1.0F + 2.0iF) != 1.0F) link_failure (); if (__builtin_crealf (1.0F + 2.0iF) != 1.0F) link_failure (); if (cimagf (fc) != 2.0F) abort (); if (__builtin_cimagf (fc) != 2.0F) abort (); if (cimagf (1.0F + 2.0iF) != 2.0F) link_failure (); if (__builtin_cimagf (1.0F + 2.0iF) != 2.0F) link_failure (); /* Test doubles. */ if (conj (dc) != 1.0 - 2.0i) abort (); if (__builtin_conj (dc) != 1.0 - 2.0i) abort (); if (conj (1.0 + 2.0i) != 1.0 - 2.0i) link_failure (); if (__builtin_conj (1.0 + 2.0i) != 1.0 - 2.0i) link_failure (); if (creal (dc) != 1.0) abort (); if (__builtin_creal (dc) != 1.0) abort (); if (creal (1.0 + 2.0i) != 1.0) link_failure (); if (__builtin_creal (1.0 + 2.0i) != 1.0) link_failure (); if (cimag (dc) != 2.0) abort (); if (__builtin_cimag (dc) != 2.0) abort (); if (cimag (1.0 + 2.0i) != 2.0) link_failure (); if (__builtin_cimag (1.0 + 2.0i) != 2.0) link_failure (); /* Test long doubles. */ if (conjl (ldc) != 1.0L - 2.0iL) abort (); if (__builtin_conjl (ldc) != 1.0L - 2.0iL) abort (); if (conjl (1.0L + 2.0iL) != 1.0L - 2.0iL) link_failure (); if (__builtin_conjl (1.0L + 2.0iL) != 1.0L - 2.0iL) link_failure (); if (creall (ldc) != 1.0L) abort (); if (__builtin_creall (ldc) != 1.0L) abort (); if (creall (1.0L + 2.0iL) != 1.0L) link_failure (); if (__builtin_creall (1.0L + 2.0iL) != 1.0L) link_failure (); if (cimagl (ldc) != 2.0L) abort (); if (__builtin_cimagl (ldc) != 2.0L) abort (); if (cimagl (1.0L + 2.0iL) != 2.0L) link_failure (); if (__builtin_cimagl (1.0L + 2.0iL) != 2.0L) link_failure (); exit (0); }
TEST(complex, cimagl) { ASSERT_EQ(0.0, cimagl(0)); }
long double cargl(long double complex z) { return (atan2l(cimagl(z), creall(z))); }
long double complex clogl(long double complex z) { long double ax, ax2h, ax2l, axh, axl, ay, ay2h, ay2l, ayh, ayl; long double sh, sl, t; long double x, y, v; uint16_t hax, hay; int kx, ky; ENTERIT(long double complex); x = creall(z); y = cimagl(z); v = atan2l(y, x); ax = fabsl(x); ay = fabsl(y); if (ax < ay) { t = ax; ax = ay; ay = t; } GET_LDBL_EXPSIGN(hax, ax); kx = hax - 16383; GET_LDBL_EXPSIGN(hay, ay); ky = hay - 16383; /* Handle NaNs and Infs using the general formula. */ if (kx == MAX_EXP || ky == MAX_EXP) RETURNI(CMPLXL(logl(hypotl(x, y)), v)); /* Avoid spurious underflow, and reduce inaccuracies when ax is 1. */ if (ax == 1) { if (ky < (MIN_EXP - 1) / 2) RETURNI(CMPLXL((ay / 2) * ay, v)); RETURNI(CMPLXL(log1pl(ay * ay) / 2, v)); } /* Avoid underflow when ax is not small. Also handle zero args. */ if (kx - ky > MANT_DIG || ay == 0) RETURNI(CMPLXL(logl(ax), v)); /* Avoid overflow. */ if (kx >= MAX_EXP - 1) RETURNI(CMPLXL(logl(hypotl(x * 0x1p-16382L, y * 0x1p-16382L)) + (MAX_EXP - 2) * ln2l_lo + (MAX_EXP - 2) * ln2_hi, v)); if (kx >= (MAX_EXP - 1) / 2) RETURNI(CMPLXL(logl(hypotl(x, y)), v)); /* Reduce inaccuracies and avoid underflow when ax is denormal. */ if (kx <= MIN_EXP - 2) RETURNI(CMPLXL(logl(hypotl(x * 0x1p16383L, y * 0x1p16383L)) + (MIN_EXP - 2) * ln2l_lo + (MIN_EXP - 2) * ln2_hi, v)); /* Avoid remaining underflows (when ax is small but not denormal). */ if (ky < (MIN_EXP - 1) / 2 + MANT_DIG) RETURNI(CMPLXL(logl(hypotl(x, y)), v)); /* Calculate ax*ax and ay*ay exactly using Dekker's algorithm. */ t = (long double)(ax * (MULT_REDUX + 1)); axh = (long double)(ax - t) + t; axl = ax - axh; ax2h = ax * ax; ax2l = axh * axh - ax2h + 2 * axh * axl + axl * axl; t = (long double)(ay * (MULT_REDUX + 1)); ayh = (long double)(ay - t) + t; ayl = ay - ayh; ay2h = ay * ay; ay2l = ayh * ayh - ay2h + 2 * ayh * ayl + ayl * ayl; /* * When log(|z|) is far from 1, accuracy in calculating the sum * of the squares is not very important since log() reduces * inaccuracies. We depended on this to use the general * formula when log(|z|) is very far from 1. When log(|z|) is * moderately far from 1, we go through the extra-precision * calculations to reduce branches and gain a little accuracy. * * When |z| is near 1, we subtract 1 and use log1p() and don't * leave it to log() to subtract 1, since we gain at least 1 bit * of accuracy in this way. * * When |z| is very near 1, subtracting 1 can cancel almost * 3*MANT_DIG bits. We arrange that subtracting 1 is exact in * doubled precision, and then do the rest of the calculation * in sloppy doubled precision. Although large cancellations * often lose lots of accuracy, here the final result is exact * in doubled precision if the large calculation occurs (because * then it is exact in tripled precision and the cancellation * removes enough bits to fit in doubled precision). Thus the * result is accurate in sloppy doubled precision, and the only * significant loss of accuracy is when it is summed and passed * to log1p(). */ sh = ax2h; sl = ay2h; _2sumF(sh, sl); if (sh < 0.5 || sh >= 3) RETURNI(CMPLXL(logl(ay2l + ax2l + sl + sh) / 2, v)); sh -= 1; _2sum(sh, sl); _2sum(ax2l, ay2l); /* Briggs-Kahan algorithm (except we discard the final low term): */ _2sum(sh, ax2l); _2sum(sl, ay2l); t = ax2l + sl; _2sumF(sh, t); RETURNI(CMPLXL(log1pl(ay2l + t + sh) / 2, v)); }
int yyparse (void) { int yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* The stacks and their tools: 'yyss': related to states. 'yyvs': related to semantic values. Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs; YYSTYPE *yyvsp; YYSIZE_T yystacksize; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ int yytoken = 0; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; yyssp = yyss = yyssa; yyvsp = yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); if (yystate == YYFINAL) YYACCEPT; goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yypact_value_is_default (yyn)) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = yylex (); } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yytable_value_is_error (yyn)) goto yyerrlab; yyn = -yyn; goto yyreduce; } /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token. */ yychar = YYEMPTY; yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 2: #line 56 "calc.y" /* yacc.c:1646 */ { switch ((yyvsp[-1].number).type) { case VT_INT: printf("%lld\n", (yyvsp[-1].number).llint); break; case VT_FLOAT: printf("%Lf\n", (yyvsp[-1].number).ldl); break; case VT_COMPLEX: if (cimagl((yyvsp[-1].number).xldl) >= 0.0) { printf("%Lf + %Lfi\n", creall((yyvsp[-1].number).xldl), cimagl((yyvsp[-1].number).xldl)); } else { printf("%Lf - %Lfi\n", creall((yyvsp[-1].number).xldl), -cimagl((yyvsp[-1].number).xldl)); } break; } } #line 1269 "calc.tab.c" /* yacc.c:1646 */ break; case 3: #line 80 "calc.y" /* yacc.c:1646 */ { (yyval.number) = (yyvsp[-1].number); } #line 1277 "calc.tab.c" /* yacc.c:1646 */ break; case 4: #line 85 "calc.y" /* yacc.c:1646 */ { value_type_t max_type = max((yyvsp[-2].number).type, (yyvsp[0].number).type); (yyval.number).type = max_type; cast_value(&(yyvsp[-2].number), max_type); cast_value(&(yyvsp[0].number), max_type); switch (max_type) { case VT_INT: (yyval.number).llint = (yyvsp[-2].number).llint + (yyvsp[0].number).llint; break; case VT_FLOAT: (yyval.number).ldl = (yyvsp[-2].number).ldl + (yyvsp[0].number).ldl; break; case VT_COMPLEX: (yyval.number).xldl = (yyvsp[-2].number).xldl + (yyvsp[0].number).xldl; break; } } #line 1302 "calc.tab.c" /* yacc.c:1646 */ break; case 5: #line 107 "calc.y" /* yacc.c:1646 */ { value_type_t max_type = max((yyvsp[-2].number).type, (yyvsp[0].number).type); (yyval.number).type = max_type; cast_value(&(yyvsp[-2].number), max_type); cast_value(&(yyvsp[0].number), max_type); switch (max_type) { case VT_INT: (yyval.number).llint = (yyvsp[-2].number).llint - (yyvsp[0].number).llint; break; case VT_FLOAT: (yyval.number).ldl = (yyvsp[-2].number).ldl - (yyvsp[0].number).ldl; break; case VT_COMPLEX: (yyval.number).xldl = (yyvsp[-2].number).xldl - (yyvsp[0].number).xldl; break; } } #line 1327 "calc.tab.c" /* yacc.c:1646 */ break; case 6: #line 129 "calc.y" /* yacc.c:1646 */ { value_type_t max_type = max((yyvsp[-2].number).type, (yyvsp[0].number).type); (yyval.number).type = max_type; cast_value(&(yyvsp[-2].number), max_type); cast_value(&(yyvsp[0].number), max_type); switch (max_type) { case VT_INT: (yyval.number).llint = (yyvsp[-2].number).llint * (yyvsp[0].number).llint; break; case VT_FLOAT: (yyval.number).ldl = (yyvsp[-2].number).ldl * (yyvsp[0].number).ldl; break; case VT_COMPLEX: (yyval.number).xldl = (yyvsp[-2].number).xldl * (yyvsp[0].number).xldl; break; } } #line 1352 "calc.tab.c" /* yacc.c:1646 */ break; case 7: #line 151 "calc.y" /* yacc.c:1646 */ { value_type_t max_type = max((yyvsp[-2].number).type, (yyvsp[0].number).type); (yyval.number).type = max_type; cast_value(&(yyvsp[-2].number), max_type); cast_value(&(yyvsp[0].number), max_type); switch (max_type) { case VT_INT: if ((yyvsp[0].number).llint != 0) { (yyval.number).llint = (yyvsp[-2].number).llint / (yyvsp[0].number).llint; } else { calcerror(); return 1; } break; case VT_FLOAT: if ((yyvsp[0].number).ldl != 0.0) { (yyval.number).ldl = (yyvsp[-2].number).ldl / (yyvsp[0].number).ldl; } else { calcerror(); return 1; } break; case VT_COMPLEX: if (creall((yyvsp[0].number).xldl) != 0.0 || cimagl((yyvsp[0].number).xldl) != 0.0) { (yyval.number).xldl = (yyvsp[-2].number).xldl / (yyvsp[0].number).xldl; } else { calcerror(); return 1; } break; } } #line 1401 "calc.tab.c" /* yacc.c:1646 */ break; #line 1405 "calc.tab.c" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires that yytoken be updated with the new translation. We take the approach of translating immediately before every use of yytoken. One alternative is translating here after every semantic action, but that translation would be missed if the semantic action invokes YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an incorrect destructor might then be invoked immediately. In the case of YYERROR or YYBACKUP, subsequent parser actions might lead to an incorrect destructor call or verbose syntax error message before the lookahead is translated. */ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*--------------------------------------. | yyerrlab -- here on detecting error. | `--------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ yyssp, yytoken) { char const *yymsgp = YY_("syntax error"); int yysyntax_error_status; yysyntax_error_status = YYSYNTAX_ERROR; if (yysyntax_error_status == 0) yymsgp = yymsg; else if (yysyntax_error_status == 1) { if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); if (!yymsg) { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; yysyntax_error_status = 2; } else { yysyntax_error_status = YYSYNTAX_ERROR; yymsgp = yymsg; } } yyerror (yymsgp); if (yysyntax_error_status == 2) goto yyexhaustedlab; } # undef YYSYNTAX_ERROR #endif } if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval); yychar = YYEMPTY; } } /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct ("Error: popping", yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEMPTY) { /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = YYTRANSLATE (yychar); yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); } /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif return yyresult; }
long double complex casinhl(long double complex z) { z = casinl(cpackl(-cimagl(z), creall(z))); return cpackl(cimagl(z), -creall(z)); }
long double complex conjl(long double complex z) { return (cpackl(creall(z), -cimagl(z))); }
long double test_cimagl(double _Complex z) { return cimagl(z); // CHECK-NO-NOT: call x86_fp80 @cimagl // CHECK-YES: call x86_fp80 @cimagl }
long double cabsl(long double complex z) { return hypotl(creall(z), cimagl(z)); }
long double complex cacoshl(long double complex z) { z = cacosl(z); return CMPLXL(-cimagl(z), creall(z)); }
long double complex csinl(long double complex z) { z = csinhl(CMPLXL(-cimagl(z), creall(z))); return CMPLXL(cimagl(z), -creall(z)); }
TEST_TRACE(C99 7.3.8.2) d = cpow(d, d); f = cpowf(f, f); ld = cpowl(ld, ld); TEST_TRACE(C99 7.3.8.3) d = csqrt(d); f = csqrtf(f); ld = csqrtl(ld); TEST_TRACE(C99 7.3.9.1) d = carg(d); f = cargf(f); ld = cargl(ld); TEST_TRACE(C99 7.3.9.2) d = cimag(d); f = cimagf(f); ld = cimagl(ld); TEST_TRACE(C99 7.3.9.3) d = conj(d); f = conjf(f); ld = conjl(ld); TEST_TRACE(C99 7.3.9.4) d = cproj(d); f = cprojf(f); ld = cprojl(ld); } TEST_TRACE(C99 7.3.9.5) double rd = creal(d); float rf = crealf(f); long double rld = creall(ld); END_GROUP
long double complex cacoshl(long double complex z) { z = cacosl(z); return cpackl(-cimagl(z), creall(z)); }
long double (cimagl)(long double complex z) { return cimagl(z); }