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

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

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.15.0
    • 1.15.0
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: