Uploaded image for project: 'Geode'
  1. Geode
  2. GEODE-9342

Handle a double reply of "inf" in the same way as Redis

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.15.0
    • Fix Version/s: 1.15.0
    • Component/s: redis

      Description

      Currently, in `Coder.java` `stringToDouble` and `doubleToString` methods, we return "Infinity" or "-Infinity", but native Redis returns "inf" or "-inf" respectively, as seen in `networking.c`:

      void addReplyDouble(client *c, double d) {
          char dbuf[128], sbuf[128];
          int dlen, slen;
          if (isinf(d)) {
              /* Libc in odd systems (Hi Solaris!) will format infinite in a
               * different way, so better to handle it in an explicit way. */
              addReplyBulkCString(c, d > 0 ? "inf" : "-inf");
          } else {
              dlen = snprintf(dbuf,sizeof(dbuf),"%.17g",d);
              slen = snprintf(sbuf,sizeof(sbuf),"$%d\r\n%s\r\n",dlen,dbuf);
              addReplyString(c,sbuf,slen);
          }
      }
      

      We should return "inf" or "-inf" like native Redis.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ringles Ray Ingles
                Reporter:
                sabbey37 Sarah Abbey
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: