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