Author: leo
Date: Fri Nov  4 14:17:33 2005
New Revision: 9788

Modified:
   trunk/ops/math.ops
   trunk/t/op/arithmetics.t
   trunk/t/pmc/float.t
Log:
fix neg 0.0 core.ops and test

Modified: trunk/ops/math.ops
==============================================================================
--- trunk/ops/math.ops  (original)
+++ trunk/ops/math.ops  Fri Nov  4 14:17:33 2005
@@ -620,12 +620,12 @@ Create $1 as the negative of $2.
 =cut
 
 inline op neg(inout INT) :base_core {
-  $1 = 0 - $1;
+  $1 = - $1;
   goto NEXT();
 }
 
 inline op neg(inout NUM) :base_core {
-  $1 = 0.0 - $1;
+  $1 = - $1;
   goto NEXT();
 }
 
@@ -635,12 +635,12 @@ inline op neg(in PMC) :base_core {
 }
 
 inline op neg(out INT, in INT) :base_core {
-  $1 = 0 - $2;
+  $1 = - $2;
   goto NEXT();
 }
 
 inline op neg(out NUM, in NUM) :base_core {
-  $1 = 0.0 - $2;
+  $1 = - $2;
   goto NEXT();
 }
 

Modified: trunk/t/op/arithmetics.t
==============================================================================
--- trunk/t/op/arithmetics.t    (original)
+++ trunk/t/op/arithmetics.t    Fri Nov  4 14:17:33 2005
@@ -241,11 +241,11 @@ output_is(<<'CODE', <<OUTPUT, "turn a na
        print "\n"
        end
 CODE
-0.000000
+-0.000000
 0.000000
 -123.456789
 123.456789
-0.000000
+-0.000000
 0.000000
 -123.456789
 123.456789

Modified: trunk/t/pmc/float.t
==============================================================================
--- trunk/t/pmc/float.t (original)
+++ trunk/t/pmc/float.t Fri Nov  4 14:17:33 2005
@@ -16,7 +16,7 @@ Tests the Float PMC.
 
 =cut
 
-use Parrot::Test tests => 44;
+use Parrot::Test tests => 45;
 
 my $fp_equality_macro = <<'ENDOFMACRO';
 .macro fp_eq ( J, K, L )
@@ -718,6 +718,16 @@ ok 1
 ok 2
 OUTPUT
 
+output_like(<< 'CODE', << 'OUTPUT', "neg 0");
+       new P0, .Float
+       set P0, 0.0
+       neg P0
+        print P0
+       end
+CODE
+/^-0/
+OUTPUT
+
 output_is(<< 'CODE', << 'OUTPUT', "Equality");
        new P0, .Float
        set P0, 1e8

Reply via email to