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

Function decFloatSetCoefficient

extern/decNumber/decCommon.c:1099–1114  ·  view source on GitHub ↗

------------------------------------------------------------------ */ decFloatSetCoefficient -- set coefficient from BCD8 */ / df is the target decFloat (and source of exponent/special value) */ bcdar holds DECPMAX digits to set the coefficient from, one */ digit in each byte (BCD8 encoding); the first (MSD) is ignored */ if df is a NaN; all are ignored if df is infinite.

Source from the content-addressed store, hash-verified

1097/* No error is possible, and no status will be set. */
1098/* ------------------------------------------------------------------ */
1099decFloat * decFloatSetCoefficient(decFloat *df, const uByte *bcdar,
1100 Int sig) {
1101 uInt exp; // for exponent
1102 uByte bcdzero[DECPMAX]; // for infinities
1103
1104 // Exponent/special code is extracted from df
1105 if (DFISSPECIAL(df)) {
1106 exp=DFWORD(df, 0)&0x7e000000;
1107 if (DFISINF(df)) {
1108 memset(bcdzero, 0, DECPMAX);
1109 return decFloatFromBCD(df, exp, bcdzero, sig);
1110 }
1111 }
1112 else exp=GETEXPUN(df);
1113 return decFloatFromBCD(df, exp, bcdar, sig);
1114 } // decFloatSetCoefficient
1115
1116/* ------------------------------------------------------------------ */
1117/* decFloatSetExponent -- set exponent or special value */

Callers

nothing calls this directly

Calls 1

decFloatFromBCDFunction · 0.85

Tested by

no test coverage detected