cvs -q diff -u
Index: classes/float.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/float.pmc,v
retrieving revision 1.11
diff -u -u -r1.11 float.pmc
--- classes/float.pmc	3 Jul 2004 19:50:13 -0000	1.11
+++ classes/float.pmc	8 Aug 2004 13:46:58 -0000
@@ -124,6 +124,22 @@
 
 /*
 
+/*
+
+=item C<INTVAL get_bool()>
+
+Evaluates the number as a boolean, i.e. it's true if it's not zero.
+
+=cut
+
+*/
+
+    INTVAL get_bool () {
+        return (INTVAL)(PMC_num_val(SELF) != 0.0);
+    }
+
+/*
+
 =item C<STRING* get_string()>
 
 Returns a Parrot string representation of the number.
Index: t/pmc/float.t
===================================================================
RCS file: /cvs/public/parrot/t/pmc/float.t,v
retrieving revision 1.3
diff -u -u -r1.3 float.t
--- t/pmc/float.t	8 Mar 2004 00:20:09 -0000	1.3
+++ t/pmc/float.t	8 Aug 2004 13:47:10 -0000
@@ -16,7 +16,7 @@
 
 =cut
 
-use Parrot::Test tests => 9;
+use Parrot::Test tests => 15;
 
 my $fp_equality_macro = <<'ENDOFMACRO';
 .macro fp_eq (	J, K, L )
@@ -370,3 +370,111 @@
 ok 3
 ok 4
 OUTPUT
+
+output_is(<< 'CODE', << 'OUTPUT', "Truth of a positive float");
+##PIR##
+.sub _main
+    .local pmc float_1
+    float_1 = new Float
+    float_1 = 123.123
+    print float_1
+    if float_1 goto IS_TRUE
+      print " is false\n"
+    end
+    IS_TRUE:
+      print " is true\n"
+    end
+.end
+CODE
+123.123 is true
+OUTPUT
+
+output_is(<< 'CODE', << 'OUTPUT', "Truth of a negative float");
+##PIR##
+.sub _main
+    .local pmc float_1
+    float_1 = new Float
+    float_1 = -123.123
+    print float_1
+    if float_1 goto IS_TRUE
+      print " is false\n"
+    end
+    IS_TRUE:
+      print " is true\n"
+    end
+.end
+CODE
+-123.123 is true
+OUTPUT
+
+output_is(<< 'CODE', << 'OUTPUT', "Truth of a positive integer");
+##PIR##
+.sub _main
+    .local pmc float_1
+    float_1 = new Float
+    float_1 = 1
+    print float_1
+    if float_1 goto IS_TRUE
+      print " is false\n"
+    end
+    IS_TRUE:
+      print " is true\n"
+    end
+.end
+CODE
+1 is true
+OUTPUT
+
+output_is(<< 'CODE', << 'OUTPUT', "Truth of a negative integer");
+##PIR##
+.sub _main
+    .local pmc float_1
+    float_1 = new Float
+    float_1 = -1
+    print float_1
+    if float_1 goto IS_TRUE
+      print " is false\n"
+    end
+    IS_TRUE:
+      print " is true\n"
+    end
+.end
+CODE
+-1 is true
+OUTPUT
+
+output_is(<< 'CODE', << 'OUTPUT', "Falseness of 0");
+##PIR##
+.sub _main
+    .local pmc float_1
+    float_1 = new Float
+    float_1 = 0
+    print float_1
+    if float_1 goto IS_TRUE
+      print " is false\n"
+    end
+    IS_TRUE:
+      print " is true\n"
+    end
+.end
+CODE
+0 is false
+OUTPUT
+
+output_is(<< 'CODE', << 'OUTPUT', "Falseness of 0.000");
+##PIR##
+.sub _main
+    .local pmc float_1
+    float_1 = new Float
+    float_1 = 0.000
+    print float_1
+    if float_1 goto IS_TRUE
+      print " is false\n"
+    end
+    IS_TRUE:
+      print " is true\n"
+    end
+.end
+CODE
+0 is false
+OUTPUT
Index: t/pmc/perlnum.t
===================================================================
RCS file: /cvs/public/parrot/t/pmc/perlnum.t,v
retrieving revision 1.7
diff -u -u -r1.7 perlnum.t
--- t/pmc/perlnum.t	18 Mar 2004 10:40:54 -0000	1.7
+++ t/pmc/perlnum.t	8 Aug 2004 13:47:10 -0000
@@ -16,7 +16,7 @@
 
 =cut
 
-use Parrot::Test tests => 36;
+use Parrot::Test tests => 42;
 
 my $fp_equality_macro = <<'ENDOFMACRO';
 .macro fp_eq (	J, K, L )
@@ -700,3 +700,111 @@
 0
 -0.000000
 OUTPUT
+
+output_is(<< 'CODE', << 'OUTPUT', "Truth of a positive float");
+##PIR##
+.sub _main
+    .local pmc float_1
+    float_1 = new Float
+    float_1 = 123.123
+    print float_1
+    if float_1 goto IS_TRUE
+      print " is false\n"
+    end
+    IS_TRUE:
+      print " is true\n"
+    end
+.end
+CODE
+123.123 is true
+OUTPUT
+
+output_is(<< 'CODE', << 'OUTPUT', "Truth of a negative float");
+##PIR##
+.sub _main
+    .local pmc float_1
+    float_1 = new Float
+    float_1 = -123.123
+    print float_1
+    if float_1 goto IS_TRUE
+      print " is false\n"
+    end
+    IS_TRUE:
+      print " is true\n"
+    end
+.end
+CODE
+-123.123 is true
+OUTPUT
+
+output_is(<< 'CODE', << 'OUTPUT', "Truth of a positive integer");
+##PIR##
+.sub _main
+    .local pmc float_1
+    float_1 = new Float
+    float_1 = 1
+    print float_1
+    if float_1 goto IS_TRUE
+      print " is false\n"
+    end
+    IS_TRUE:
+      print " is true\n"
+    end
+.end
+CODE
+1 is true
+OUTPUT
+
+output_is(<< 'CODE', << 'OUTPUT', "Truth of a negative integer");
+##PIR##
+.sub _main
+    .local pmc float_1
+    float_1 = new Float
+    float_1 = -1
+    print float_1
+    if float_1 goto IS_TRUE
+      print " is false\n"
+    end
+    IS_TRUE:
+      print " is true\n"
+    end
+.end
+CODE
+-1 is true
+OUTPUT
+
+output_is(<< 'CODE', << 'OUTPUT', "Falseness of 0");
+##PIR##
+.sub _main
+    .local pmc float_1
+    float_1 = new Float
+    float_1 = 0
+    print float_1
+    if float_1 goto IS_TRUE
+      print " is false\n"
+    end
+    IS_TRUE:
+      print " is true\n"
+    end
+.end
+CODE
+0 is false
+OUTPUT
+
+output_is(<< 'CODE', << 'OUTPUT', "Falseness of 0.000");
+##PIR##
+.sub _main
+    .local pmc float_1
+    float_1 = new Float
+    float_1 = 0.000
+    print float_1
+    if float_1 goto IS_TRUE
+      print " is false\n"
+    end
+    IS_TRUE:
+      print " is true\n"
+    end
+.end
+CODE
+0 is false
+OUTPUT
