[svn:parrot] r36660 - trunk/src/ops

rurban at svn.parrot.org rurban at svn.parrot.org
Fri Feb 13 06:11:09 UTC 2009


Author: rurban
Date: Fri Feb 13 06:11:08 2009
New Revision: 36660
URL: https://trac.parrot.org/parrot/changeset/36660

Log:
Add a missing fix for TT #313, forgotten in r36638
Thanks to Andy Dougherty for spotting this.
This fixes the immediate problem and all tests,
but it might be an alternative to change it in src/spf_render.c,
our internal snprintf.

Modified:
   trunk/src/ops/io.ops

Modified: trunk/src/ops/io.ops
==============================================================================
--- trunk/src/ops/io.ops	Fri Feb 13 05:24:54 2009	(r36659)
+++ trunk/src/ops/io.ops	Fri Feb 13 06:11:08 2009	(r36660)
@@ -152,7 +152,17 @@
 }
 
 inline op print(in NUM) :base_io {
+#ifdef PARROT_HAS_NEGATIVE_ZERO
   Parrot_io_printf(interp, FLOATVAL_FMT, $1);
+#else
+  /* Workaround for older msvcrt and openbsd. TT #313 */
+  if (Parrot_is_nzero($1)) {
+    Parrot_io_printf(interp, "-0");
+  }
+  else {
+    Parrot_io_printf(interp, FLOATVAL_FMT, $1);
+  }
+#endif
 }
 
 op print(in STR) :base_io {
@@ -185,7 +195,17 @@
 }
 
 inline op say(in NUM) :base_io {
+#ifdef PARROT_HAS_NEGATIVE_ZERO
   Parrot_io_printf(interp, FLOATVAL_FMT "\n", $1);
+#else
+  /* Workaround for older msvcrt and openbsd. TT #313 */
+  if (Parrot_is_nzero($1)) {
+      Parrot_io_printf(interp, "-0\n");
+  }
+  else {
+      Parrot_io_printf(interp, FLOATVAL_FMT "\n", $1);
+  }
+#endif
 }
 
 op say(in STR) :base_io {


More information about the parrot-commits mailing list