HTTP/1.1 -1 Read error in cache disk data: SuccessContent-Type: text/plain
Last-Modified: Thu, 12 Aug 2010 00:00:10 GMT
ETag: "6a3f5-1e29-48d950cbacd11"
Content-length: 7721
Connection: Close
Proxy-Connection: Close
X-Cache: HIT from web1.osuosl.org
Server: ProxyTrack 0.5 (HTTrack 3.49.2)

Index: src/ops/set.ops
===================================================================
--- src/ops/set.ops	(revision 48320)
+++ src/ops/set.ops	(working copy)
@@ -40,6 +40,9 @@
 
 =item B<set>(out INT, in NUM)
 
+A floating-point number is truncated (rounded toward zero) when assigned
+to an integer register.
+
 =item B<set>(out INT, invar PMC)
 
 =item B<set>(out INT, invar PMC)
Index: src/dynoplibs/trans.ops
===================================================================
--- src/dynoplibs/trans.ops	(revision 48320)
+++ src/dynoplibs/trans.ops	(working copy)
@@ -105,6 +105,30 @@
 
 ########################################
 
+=item B<cot>(out NUM, in NUM)
+
+Set $1 to the cotangent of $2 (given in radians).
+
+=cut
+
+inline op cot(out NUM, in NUM) :base_math {
+    $1 = ((FLOATVAL)1) / tan((FLOATVAL)$2);
+}
+
+########################################
+
+=item B<csc>(out NUM, in NUM)
+
+Set $1 to the cosecant of $2 (given in radians).
+
+=cut
+
+inline op csc(out NUM, in NUM) :base_math {
+    $1 = ((FLOATVAL)1) / sin((FLOATVAL)$2);
+}
+
+########################################
+
 =item B<exp>(out NUM, in NUM)
 
 Set $1 to I<e> raised to the power $2. I<e> is the base of the natural
Index: src/pmc/float.pmc
===================================================================
--- src/pmc/float.pmc	(revision 48320)
+++ src/pmc/float.pmc	(working copy)
@@ -77,7 +77,8 @@
 
 =item C<INTVAL get_integer()>
 
-Returns an integer representation of the number (by casting).
+Returns an integer representation of the number by truncating
+(rounding toward zero).
 
 =cut
 
@@ -391,6 +392,10 @@
 
 =item C<METHOD PMC *cosh()>
 
+=item C<METHOD PMC *cot()>
+
+=item C<METHOD PMC *csc()>
+
 =item C<METHOD PMC *exp()>
 
 =item C<METHOD PMC *ln()>
@@ -425,13 +430,6 @@
         RETURN(PMC *d);
     }
 
-    METHOD cos() {
-        PMC * const d  = Parrot_pmc_new(INTERP,
-                Parrot_get_ctx_HLL_type(INTERP, enum_class_Float));
-        SET_ATTR_fv(INTERP, d, cos(SELF.get_number()));
-        RETURN(PMC *d);
-    }
-
     METHOD asec() {
         PMC * const d  = Parrot_pmc_new(INTERP, VTABLE_type(INTERP, SELF));
         SET_ATTR_fv(INTERP, d, acos(1.0 / SELF.get_number()));
@@ -456,12 +454,31 @@
         RETURN(PMC *d);
     }
 
+    METHOD cos() {
+        PMC * const d  = Parrot_pmc_new(INTERP,
+                Parrot_get_ctx_HLL_type(INTERP, enum_class_Float));
+        SET_ATTR_fv(INTERP, d, cos(SELF.get_number()));
+        RETURN(PMC *d);
+    }
+
     METHOD cosh() {
         PMC * const d  = Parrot_pmc_new(INTERP, VTABLE_type(INTERP, SELF));
         SET_ATTR_fv(INTERP, d, cosh(SELF.get_number()));
         RETURN(PMC *d);
     }
 
+    METHOD cot() {
+        PMC * const d  = Parrot_pmc_new(INTERP, VTABLE_type(INTERP, SELF));
+        SET_ATTR_fv(INTERP, d, 1.0 / tan(SELF.get_number()));
+        RETURN(PMC *d);
+    }
+
+    METHOD csc() {
+        PMC * const d  = Parrot_pmc_new(INTERP, VTABLE_type(INTERP, SELF));
+        SET_ATTR_fv(INTERP, d, 1.0 / sin(SELF.get_number()));
+        RETURN(PMC *d);
+    }
+
     METHOD exp() {
         PMC * const d  = Parrot_pmc_new(INTERP, VTABLE_type(INTERP, SELF));
         SET_ATTR_fv(INTERP, d, exp(SELF.get_number()));
Index: t/pmc/float.t
===================================================================
--- t/pmc/float.t	(revision 48320)
+++ t/pmc/float.t	(working copy)
@@ -16,7 +16,7 @@
 
 =cut
 
-.const int TESTS = 162
+.const int TESTS = 166
 .const num PRECISION = 0.000001
 
 .sub 'test' :main
@@ -78,10 +78,12 @@
     log10_method()
     log2_method()
     sec_method()
+    csc_method()
     sech_method()
     sin_method()
     sinh_method()
     tan_method()
+    cot_method()
     tanh_method()
     sqrt_method()
 .end
@@ -998,6 +1000,11 @@
     test_method('sec', 0.5, 1.139493927)
 .end
 
+.sub 'csc_method'
+    test_method('csc', 0.5, 2.0858296)
+    test_method('csc', 1.0, 1.1883951)
+.end
+
 .sub 'sech_method'
     test_method('sech', 0.0, 1.0)
     test_method('sech', 0.5, 0.886818884)
@@ -1018,6 +1025,11 @@
     test_method('tan', 0.5, 0.546302490)
 .end
 
+.sub 'cot_method'
+    test_method('cot', 0.5, 1.8304877)
+    test_method('cot', 1.0, 0.64209262)
+.end
+
 .sub 'tanh_method'
     test_method('tanh', 0.0, 0.0)
     test_method('tanh', 0.5, 0.462117157)
Index: t/dynoplibs/trans.t
===================================================================
--- t/dynoplibs/trans.t	(revision 48320)
+++ t/dynoplibs/trans.t	(working copy)
@@ -23,7 +23,7 @@
     .local num epsilon
     epsilon = _epsilon()
 
-    plan(69)
+    plan(77)
 
     test_sin_n(epsilon)
     test_sin_i(epsilon)
@@ -31,8 +31,12 @@
     test_cos_i(epsilon)
     test_tan_n(epsilon)
     test_tan_i(epsilon)
+    test_cot_n(epsilon)
+    test_cot_i(epsilon)
     test_sec_n(epsilon)
     test_sec_i(epsilon)
+    test_csc_n(epsilon)
+    test_csc_i(epsilon)
     test_atan_n(epsilon)
     test_atan_i(epsilon)
     test_asin_n(epsilon)
@@ -137,6 +141,26 @@
     is($N0, 1.557408, "tan(1)", epsilon)
 .end
 
+.sub test_cot_n
+    .param num epsilon
+
+    $N0 = cot 0.5
+    is($N0,  1.8305, "cot(0.5)", epsilon)
+
+    $N0 = cot 1.0
+    is($N0,  0.64209, "cot(1.0)", epsilon)
+.end
+
+.sub test_cot_i
+    .param num epsilon
+
+    $N0 = cot 1
+    is($N0, 0.64209, "cot(1)", epsilon)
+
+    $N0 = cot 2
+    is($N0,  -0.45766, "cot(2)", epsilon)
+.end
+
 .sub test_sec_n
     .param num epsilon
 
@@ -153,6 +177,26 @@
     is($N1, 1.850816, "sec(1)", epsilon)
 .end
 
+.sub test_csc_n
+    .param num epsilon
+
+    $N0 = csc 0.5
+    is($N0,   2.0858, "csc(0.5)", epsilon)
+
+    $N0 = csc 1.0
+    is($N0,  1.1884, "csc(1.0)", epsilon)
+.end
+
+.sub test_csc_i
+    .param num epsilon
+
+    $N0 = csc 1
+    is($N0, 1.1884, "csc(1)", epsilon)
+
+    $N0 = csc 2
+    is($N0,   1.0998, "csc(2)", epsilon)
+.end
+
 .sub test_atan_n
     .param num epsilon
 
Index: t/dynoplibs/trans-infnan.t
===================================================================
--- t/dynoplibs/trans-infnan.t	(revision 48320)
+++ t/dynoplibs/trans-infnan.t	(working copy)
@@ -20,7 +20,7 @@
 
 .sub main :main
     .include 'test_more.pir'
-    plan(67)
+    plan(70)
 
     test_exp()
     test_sin()
@@ -36,6 +36,7 @@
     test_coth()
     test_acot()
     test_sec()
+    test_csc()
     test_sech()
     test_asec()
     test_ln()
@@ -232,6 +233,18 @@
     is($N1, 'NaN', '... sec NaN')
 .end
 
+.sub test_csc
+    $N0 = 'Inf'
+    $N1 = csc $N0
+    is($N1, 'NaN', 'csc: csc Inf')
+    $N0 = '-Inf'
+    $N1 = csc $N0
+    is($N1, 'NaN', '... csc -Inf')
+    $N0 = 'NaN'
+    $N1 = csc $N0
+    is($N1, 'NaN', '... csc NaN')
+.end
+
 .sub test_sech
     $N0 = 'Inf'
     $N1 = sech $N0
@@ -295,20 +308,16 @@
     is($N1, 'NaN', '... log2 -Inf')
 .end
 
-
 .sub test_cot
     $N0 = 'Inf'
-    #$N1 = cot $N0
-    #is($N1, 'NaN', 'cot: cot Inf')
-    todo(0, 'cot Inf', 'cot/coth/acot not implemented for real numbers')
+    $N1 = cot $N0
+    is($N1, 'NaN', 'cot: cot Inf')
     $N0 = '-Inf'
-    #$N1 = cot $N0
-    #is($N1, 'NaN', '... cot -Inf')
-    todo(0, 'cot -Inf', 'cot/coth/acot not implemented for real numbers')
+    $N1 = cot $N0
+    is($N1, 'NaN', '... cot -Inf')
     $N0 = 'NaN'
-    #$N1 = cot $N0
-    #is($N1, 'NaN', '... cot NaN')
-    todo(0, 'cot NaN', 'cot/coth/acot not implemented for real numbers')
+    $N1 = cot $N0
+    is($N1, 'NaN', '... cot NaN')
 .end
 
 .sub test_pow
(steal from parrot-instrument)</span> </td>
                      </tr><tr>
                        <th>11</th><th> </th><td class="l"><span>&nbsp;<del></del>code introspection (steal from parrot-instrument)</span> </td>
                      </tr><tr>
                        <th>12</th><th> </th><td class="l"><