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

Function decFloatSetExponent

extern/decNumber/decCommon.c:1127–1139  ·  view source on GitHub ↗

------------------------------------------------------------------ */ decFloatSetExponent -- set exponent or special value */ / df is the target decFloat (and source of coefficient/payload) */ set is the context for reporting status */ exp is the unbiased exponent, q, or a special value in the form */ returned by decFloatGetExponent

Source from the content-addressed store, hash-verified

1125/* No error is possible, but Overflow or Underflow might occur. */
1126/* ------------------------------------------------------------------ */
1127decFloat * decFloatSetExponent(decFloat *df, decContext *set, Int exp) {
1128 uByte bcdcopy[DECPMAX]; // for coefficient
1129 bcdnum num; // work
1130 num.exponent=exp;
1131 num.sign=decFloatGetCoefficient(df, bcdcopy); // extract coefficient
1132 if (DFISSPECIAL(df)) { // MSD or more needs correcting
1133 if (DFISINF(df)) memset(bcdcopy, 0, DECPMAX);
1134 bcdcopy[0]=0;
1135 }
1136 num.msd=bcdcopy;
1137 num.lsd=bcdcopy+DECPMAX-1;
1138 return decFinalize(df, &num, set);
1139 } // decFloatSetExponent
1140
1141/* ------------------------------------------------------------------ */
1142/* decFloatRadix -- returns the base (10) */

Callers 1

decFloatScaleBFunction · 0.85

Calls 2

decFloatGetCoefficientFunction · 0.85
decFinalizeFunction · 0.70

Tested by

no test coverage detected