MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / evlSign

Function evlSign

src/jrd/SysFunction.cpp:6585–6613  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6583
6584
6585dsc* evlSign(thread_db* tdbb, const SysFunction*, const NestValueArray& args,
6586 impure_value* impure)
6587{
6588 fb_assert(args.getCount() == 1);
6589
6590 Request* request = tdbb->getRequest();
6591
6592 const dsc* value = EVL_expr(tdbb, request, args[0]);
6593 if (request->req_flags & req_null) // return NULL if value is NULL
6594 return NULL;
6595
6596 if (value->isDecFloat())
6597 impure->vlu_misc.vlu_short = MOV_get_dec128(tdbb, value).sign();
6598 else
6599 {
6600 const double val = MOV_get_double(tdbb, value);
6601
6602 if (val > 0)
6603 impure->vlu_misc.vlu_short = 1;
6604 else if (val < 0)
6605 impure->vlu_misc.vlu_short = -1;
6606 else // val == 0
6607 impure->vlu_misc.vlu_short = 0;
6608 }
6609
6610 impure->vlu_desc.makeShort(0, &impure->vlu_misc.vlu_short);
6611
6612 return &impure->vlu_desc;
6613}
6614
6615
6616dsc* evlSqrt(thread_db* tdbb, const SysFunction* function, const NestValueArray& args,

Callers

nothing calls this directly

Calls 8

EVL_exprFunction · 0.85
MOV_get_dec128Function · 0.85
MOV_get_doubleFunction · 0.85
isDecFloatMethod · 0.80
makeShortMethod · 0.80
getCountMethod · 0.45
getRequestMethod · 0.45
signMethod · 0.45

Tested by

no test coverage detected