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

Function decSetMaxValue

extern/decNumber/decNumber.c:7392–7407  ·  view source on GitHub ↗

------------------------------------------------------------------ */ decSetMaxValue -- set number to +Nmax (maximum normal value) */ / dn is the number to set */ set is the context [used for digits and emax] */ / This sets the number to the maximum positive value. */ --------------------------------------------------

Source from the content-addressed store, hash-verified

7390/* This sets the number to the maximum positive value. */
7391/* ------------------------------------------------------------------ */
7392static void decSetMaxValue(decNumber *dn, decContext *set) {
7393 Unit *up; // work
7394 Int count=set->digits; // nines to add
7395 dn->digits=count;
7396 // fill in all nines to set maximum value
7397 for (up=dn->lsu; ; up++) {
7398 if (count>DECDPUN) *up=DECDPUNMAX; // unit full o'nines
7399 else { // this is the msu
7400 *up=(Unit)(powers[count]-1);
7401 break;
7402 }
7403 count-=DECDPUN; // filled those digits
7404 } // up
7405 dn->bits=0; // + sign
7406 dn->exponent=set->emax-set->digits+1;
7407 } // decSetMaxValue
7408
7409/* ------------------------------------------------------------------ */
7410/* decSetSubnormal -- process value whose exponent is <Emin */

Callers 4

decNumberNextMinusFunction · 0.85
decNumberNextPlusFunction · 0.85
decNumberNextTowardFunction · 0.85
decSetOverflowFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected