[Groonga-commit] groonga/groonga at 22afe01 [master] Use NaN, Infinity and -Infinity instead of Lisp representations

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Dec 8 19:13:23 JST 2017


Kouhei Sutou	2017-12-08 19:13:23 +0900 (Fri, 08 Dec 2017)

  New Revision: 22afe0118de02247794bd608d40c1424f9121b1d
  https://github.com/groonga/groonga/commit/22afe0118de02247794bd608d40c1424f9121b1d

  Message:
    Use NaN, Infinity and -Infinity instead of Lisp representations
    
    They are used in JavaScript.

  Modified files:
    lib/str.c

  Modified: lib/str.c (+4 -4)
===================================================================
--- lib/str.c    2017-12-08 18:26:01 +0900 (b894901e7)
+++ lib/str.c    2017-12-08 19:13:23 +0900 (ab720cdb0)
@@ -2132,10 +2132,10 @@ grn_text_ftoa(grn_ctx *ctx, grn_obj *buf, double d)
 #ifdef HAVE_FPCLASSIFY
   switch (fpclassify(d)) {
   case FP_NAN :
-    GRN_TEXT_PUTS(ctx, buf, "#<nan>");
+    GRN_TEXT_PUTS(ctx, buf, "NaN");
     break;
   case FP_INFINITE :
-    GRN_TEXT_PUTS(ctx, buf, d > 0 ? "#i1/0" : "#i-1/0");
+    GRN_TEXT_PUTS(ctx, buf, d > 0 ? "Infinity" : "-Infinity");
     break;
   default :
     ftoa_(ctx, buf, d);
@@ -2144,12 +2144,12 @@ grn_text_ftoa(grn_ctx *ctx, grn_obj *buf, double d)
 #else /* HAVE_FPCLASSIFY */
   if (d == d) {
     if (d != 0 && ((d / 2.0) == d)) {
-      GRN_TEXT_PUTS(ctx, buf, d > 0 ? "#i1/0" : "#i-1/0");
+      GRN_TEXT_PUTS(ctx, buf, d > 0 ? "Infinity" : "-Infinity");
     } else {
       ftoa_(ctx, buf, d);
     }
   } else {
-    GRN_TEXT_PUTS(ctx, buf, "#<nan>");
+    GRN_TEXT_PUTS(ctx, buf, "NaN");
   }
 #endif /* HAVE_FPCLASSIFY */
   return rc;
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20171208/35f50e27/attachment-0001.htm 



More information about the Groonga-commit mailing list
Back to archive index