MCPcopy Create free account
hub / github.com/F-Stack/f-stack / createStringObjectFromLongDouble

Function createStringObjectFromLongDouble

app/redis-6.2.6/src/object.c:194–198  ·  view source on GitHub ↗

Create a string object from a long double. If humanfriendly is non-zero * it does not use exponential format and trims trailing zeroes at the end, * however this results in loss of precision. Otherwise exp format is used * and the output of snprintf() is not modified. * * The 'humanfriendly' option is used for INCRBYFLOAT and HINCRBYFLOAT. */

Source from the content-addressed store, hash-verified

192 *
193 * The 'humanfriendly' option is used for INCRBYFLOAT and HINCRBYFLOAT. */
194robj *createStringObjectFromLongDouble(long double value, int humanfriendly) {
195 char buf[MAX_LONG_DOUBLE_CHARS];
196 int len = ld2string(buf,sizeof(buf),value,humanfriendly? LD_STR_HUMAN: LD_STR_AUTO);
197 return createStringObject(buf,len);
198}
199
200/* Duplicate a string object, with the guarantee that the returned object
201 * has the same encoding as the original one.

Callers 4

incrbyfloatCommandFunction · 0.85
addReplyHumanLongDoubleFunction · 0.85
scanCallbackFunction · 0.85
moduleScanKeyCallbackFunction · 0.85

Calls 2

ld2stringFunction · 0.85
createStringObjectFunction · 0.70

Tested by

no test coverage detected