Add a long double as a bulk reply, but uses a human readable formatting * of the double instead of exposing the crude behavior of doubles to the * dear user. */
| 866 | * of the double instead of exposing the crude behavior of doubles to the |
| 867 | * dear user. */ |
| 868 | void addReplyHumanLongDouble(client *c, long double d) { |
| 869 | if (c->resp == 2) { |
| 870 | robj *o = createStringObjectFromLongDouble(d,1); |
| 871 | addReplyBulk(c,o); |
| 872 | decrRefCount(o); |
| 873 | } else { |
| 874 | char buf[MAX_LONG_DOUBLE_CHARS]; |
| 875 | int len = ld2string(buf,sizeof(buf),d,LD_STR_HUMAN); |
| 876 | addReplyProto(c,",",1); |
| 877 | addReplyProto(c,buf,len); |
| 878 | addReplyProto(c,"\r\n",2); |
| 879 | } |
| 880 | } |
| 881 | |
| 882 | /* Add a long long as integer reply or bulk len / multi bulk count. |
| 883 | * Basically this is used to output <prefix><long long><crlf>. */ |
no test coverage detected