ZSets double to string serialization fixed

This commit is contained in:
antirez
2009-11-03 14:36:38 +01:00
parent 9155ea9c71
commit eaa256ad25
4 changed files with 22 additions and 6 deletions

View File

@ -2331,7 +2331,7 @@ static int rdbSaveDoubleValue(FILE *fp, double val) {
len = 1;
buf[0] = (val < 0) ? 255 : 254;
} else {
snprintf((char*)buf+1,sizeof(buf)-1,"%.16g",val);
snprintf((char*)buf+1,sizeof(buf)-1,"%.17g",val);
buf[0] = strlen((char*)buf);
len = buf[0]+1;
}
@ -4307,7 +4307,7 @@ static void zscoreCommand(redisClient *c) {
char buf[128];
double *score = dictGetEntryVal(de);
snprintf(buf,sizeof(buf),"%.16g",*score);
snprintf(buf,sizeof(buf),"%.17g",*score);
addReplySds(c,sdscatprintf(sdsempty(),"$%d\r\n%s\r\n",
strlen(buf),buf));
}