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

Function decFloatShow

extern/decNumber/decCommon.c:1160–1178  ·  view source on GitHub ↗

------------------------------------------------------------------ */ decFloatShow -- printf a decFloat in hexadecimal and decimal */ df is the decFloat to show */ tag is a tag string displayed with the number */ / This is a debug aid; the precise format of the string may change. */ ----------------------------------------------------

Source from the content-addressed store, hash-verified

1158/* This is a debug aid; the precise format of the string may change. */
1159/* ------------------------------------------------------------------ */
1160void decFloatShow(const decFloat *df, const char *tag) {
1161 char hexbuf[DECBYTES*2+DECBYTES/4+1]; // NB blank after every fourth
1162 char buff[DECSTRING]; // for value in decimal
1163 Int i, j=0;
1164
1165 for (i=0; i<DECBYTES; i++) {
1166 #if DECLITEND
1167 sprintf(&hexbuf[j], "%02x", df->bytes[DECBYTES-1-i]);
1168 #else
1169 sprintf(&hexbuf[j], "%02x", df->bytes[i]);
1170 #endif
1171 j+=2;
1172 // the next line adds blank (and terminator) after final pair, too
1173 if ((i+1)%4==0) {strcpy(&hexbuf[j], " "); j++;}
1174 }
1175 decFloatToString(df, buff);
1176 printf(">%s> %s [big-endian] %s\n", tag, hexbuf, buff);
1177 return;
1178 } // decFloatShow
1179#endif
1180
1181/* ------------------------------------------------------------------ */

Callers 2

decFiniteMultiplyFunction · 0.85
decFloatAddFunction · 0.85

Calls 1

decFloatToStringFunction · 0.85

Tested by

no test coverage detected