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. */
| 707 | * of the double instead of exposing the crude behavior of doubles to the |
| 708 | * dear user. */ |
| 709 | void addReplyHumanLongDouble(client *c, long double d) { |
| 710 | if (c->resp == 2) { |
| 711 | robj *o = createStringObjectFromLongDouble(d,1); |
| 712 | addReplyBulk(c,o); |
| 713 | decrRefCount(o); |
| 714 | } else { |
| 715 | char buf[MAX_LONG_DOUBLE_CHARS]; |
| 716 | int len = ld2string(buf,sizeof(buf),d,LD_STR_HUMAN); |
| 717 | addReplyProto(c,",",1); |
| 718 | addReplyProto(c,buf,len); |
| 719 | addReplyProto(c,"\r\n",2); |
| 720 | } |
| 721 | } |
| 722 | |
| 723 | /* Add a long long as integer reply or bulk len / multi bulk count. |
| 724 | * Basically this is used to output <prefix><long long><crlf>. */ |
no test coverage detected