Author: bernhard
Date: Wed Mar 14 13:10:29 2007
New Revision: 17481

Modified:
   trunk/languages/plumhead/src/common/builtins.pir
   trunk/languages/plumhead/t/arithmetics.t

Log:
[Plumhead]
No longer turn integers into floats before
negating them.


Modified: trunk/languages/plumhead/src/common/builtins.pir
==============================================================================
--- trunk/languages/plumhead/src/common/builtins.pir    (original)
+++ trunk/languages/plumhead/src/common/builtins.pir    Wed Mar 14 13:10:29 2007
@@ -34,7 +34,7 @@
     .return (1)
 .end
 
-.sub 'prefix:-'
+.sub 'prefix:-' :multi(Float)
     .param pmc a
 
     $N0 = a
@@ -43,6 +43,14 @@
     .return ($N0)
 .end
 
+.sub 'prefix:-' :multi(Integer)
+    .param int a
+
+    $I0 = neg a
+
+    .return ($I0)
+.end
+
 
 .sub 'infix:+&'
     .param int a

Modified: trunk/languages/plumhead/t/arithmetics.t
==============================================================================
--- trunk/languages/plumhead/t/arithmetics.t    (original)
+++ trunk/languages/plumhead/t/arithmetics.t    Wed Mar 14 13:10:29 2007
@@ -107,6 +107,7 @@
     [ '  ( 1 * 2 ) + ( ( ( ( 3 + 4 ) + 5 ) * 6 ) * 7 ) ', '506', ],
     [ '1.2', '1.2', ],
     [ '-1.23', '-1.23', ],
+    [ '-0.12345', '-0.12345', ],
     [ '.1', '0.1', 'Parrot says 0.1', ],
     [ '-.1', '-0.1', 'Parrot bc says -0.1',],
     [ '2 / 2 + .1', '1.1', ],

Reply via email to