MCPcopy Create free account
hub / github.com/KratosMultiphysics/Kratos / power

Function power

external_libraries/tinyexpr/tinyexpr/tinyexpr.c:448–471  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

446
447
448static te_expr *power(state *s) {
449 /* <power> = {("-" | "+")} <base> */
450 int sign = 1;
451 while (s->type == TOK_INFIX && (s->function == add || s->function == sub)) {
452 if (s->function == sub) sign = -sign;
453 next_token(s);
454 }
455
456 te_expr *ret;
457
458 if (sign == 1) {
459 ret = base(s);
460 } else {
461 te_expr *b = base(s);
462 CHECK_NULL(b);
463
464 ret = NEW_EXPR(TE_FUNCTION1 | TE_FLAG_PURE, b);
465 CHECK_NULL(ret, te_free(b));
466
467 ret->function = negate;
468 }
469
470 return ret;
471}
472
473#ifdef TE_POW_FROM_RIGHT
474static te_expr *factor(state *s) {

Callers 2

baseFunction · 0.70
factorFunction · 0.70

Calls 3

next_tokenFunction · 0.85
baseFunction · 0.85
te_freeFunction · 0.85

Tested by

no test coverage detected