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

Function decNumberAbs

extern/decNumber/decNumber.c:727–744  ·  view source on GitHub ↗

------------------------------------------------------------------ */ decNumberAbs -- absolute value operator */ / This computes C = abs(A) */ / res is C, the result. C may be A */ rhs is A */ set is the context

Source from the content-addressed store, hash-verified

725/* in which case it has the same effect as decNumberMinus. */
726/* ------------------------------------------------------------------ */
727decNumber * decNumberAbs(decNumber *res, const decNumber *rhs,
728 decContext *set) {
729 decNumber dzero; // for 0
730 uInt status=0; // accumulator
731
732 #if DECCHECK
733 if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
734 #endif
735
736 decNumberZero(&dzero); // set 0
737 dzero.exponent=rhs->exponent; // [no coefficient expansion]
738 decAddOp(res, &dzero, rhs, set, (uByte)(rhs->bits & DECNEG), &status);
739 if (status!=0) decStatus(res, status, set);
740 #if DECCHECK
741 decCheckInexact(res, set);
742 #endif
743 return res;
744 } // decNumberAbs
745
746/* ------------------------------------------------------------------ */
747/* decNumberAdd -- add two Numbers */

Callers

nothing calls this directly

Calls 3

decCheckOperandsFunction · 0.85
decStatusFunction · 0.85
decCheckInexactFunction · 0.85

Tested by

no test coverage detected