# New Ticket Created by  "Sean O'Rourke" 
# Please include the string:  [perl #823]
# in the subject line of all future correspondence about this issue. 
# <URL: http://bugs6.perl.org/rt2/Ticket/Display.html?id=823 >

NOTE: this may be part of the monster-patch to fix the over-agressive
string GC (814), but it's much more palatable in this form.  PerlInt's
cmp() method was backwards, and would truncate floats on the other side of
the comparison.  This patch always uses floating-point, and makes the
direction consistent with the PDD 2.

/s

Index: perlint.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/perlint.pmc,v
retrieving revision 1.24
diff -u -r1.24 perlint.pmc
--- perlint.pmc 12 Jun 2002 22:12:18 -0000      1.24
+++ perlint.pmc 16 Jul 2002 04:14:09 -0000

@@ -557,14 +558,14 @@
     }

     INTVAL cmp(PMC* value) {
-        INTVAL diff;
-        diff = value->vtable->get_integer(INTERP, value) - SELF->cache.int_val;
+        FLOATVAL diff;
+        diff = SELF->cache.int_val - value->vtable->get_number(INTERP, value);
         return diff > 0 ? 1 : diff < 0 ? -1 : 0;
     }

     INTVAL cmp_num(PMC* value) {
-        INTVAL diff;
-        diff = value->vtable->get_integer(INTERP, value) - SELF->cache.int_val;
+        FLOATVAL diff;
+        diff = SELF->cache.int_val - value->vtable->get_number(INTERP, value);
         return diff > 0 ? 1 : diff < 0 ? -1 : 0;
     }





Reply via email to