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

Function decNumberMinus

extern/decNumber/decNumber.c:1626–1643  ·  view source on GitHub ↗

------------------------------------------------------------------ */ decNumberMinus -- prefix minus operator */ / This computes C = 0 - 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

1624/* Simply use AddOp for the subtract, which will do the necessary. */
1625/* ------------------------------------------------------------------ */
1626decNumber * decNumberMinus(decNumber *res, const decNumber *rhs,
1627 decContext *set) {
1628 decNumber dzero;
1629 uInt status=0; // accumulator
1630
1631 #if DECCHECK
1632 if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
1633 #endif
1634
1635 decNumberZero(&dzero); // make 0
1636 dzero.exponent=rhs->exponent; // [no coefficient expansion]
1637 decAddOp(res, &dzero, rhs, set, DECNEG, &status);
1638 if (status!=0) decStatus(res, status, set);
1639 #if DECCHECK
1640 decCheckInexact(res, set);
1641 #endif
1642 return res;
1643 } // decNumberMinus
1644
1645/* ------------------------------------------------------------------ */
1646/* decNumberNextMinus -- next towards -Infinity */

Callers

nothing calls this directly

Calls 3

decCheckOperandsFunction · 0.85
decStatusFunction · 0.85
decCheckInexactFunction · 0.85

Tested by

no test coverage detected