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. */
| 218 | * |
| 219 | * The 'humanfriendly' option is used for INCRBYFLOAT and HINCRBYFLOAT. */ |
| 220 | robj *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. |
no test coverage detected