MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / createStringObjectFromLongDouble

Function createStringObjectFromLongDouble

src/object.cpp:220–224  ·  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

218 *
219 * The 'humanfriendly' option is used for INCRBYFLOAT and HINCRBYFLOAT. */
220robj *createStringObjectFromLongDouble(long double value, int humanfriendly) {
221 char buf[MAX_LONG_DOUBLE_CHARS];
222 int len = ld2string(buf,sizeof(buf),value,humanfriendly? LD_STR_HUMAN: LD_STR_AUTO);
223 return createStringObject(buf,len);
224}
225
226/* Duplicate a string object, with the guarantee that the returned object
227 * has the same encoding as the original one.

Callers 4

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

Calls 2

ld2stringFunction · 0.85
createStringObjectFunction · 0.70

Tested by

no test coverage detected