This repository was archived by the owner on Dec 27, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -311,6 +311,20 @@ public function sin($scale = null)
311
311
);
312
312
}
313
313
314
+ /**
315
+ * Throws exception because cosecant is undefined in the infinite.
316
+ *
317
+ * @param integer $scale
318
+ * @return null
319
+ */
320
+ public function cosec ($ scale = null )
321
+ {
322
+ throw new \DomainException (($ this === self ::$ pInf ) ?
323
+ "Cosecant function hasn't limit in the positive infinite. " :
324
+ "Cosecant function hasn't limit in the negative infinite. "
325
+ );
326
+ }
327
+
314
328
/**
315
329
* Throws exception because cosine is undefined in the infinite.
316
330
*
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ use Litipk \BigNumbers \InfiniteDecimal as InfiniteDecimal ;
4
+
5
+ /**
6
+ * @group cos
7
+ */
8
+ class InfiniteDecimalCosecTest extends PHPUnit_Framework_TestCase
9
+ {
10
+ /**
11
+ * @expectedException \DomainException
12
+ * @expectedExceptionMessage Cosecant function hasn't limit in the positive infinite.
13
+ */
14
+ public function testFinitePositiveInfiniteCosec ()
15
+ {
16
+ InfiniteDecimal::getPositiveInfinite ()->cosec ();
17
+ }
18
+
19
+ /**
20
+ * @expectedException \DomainException
21
+ * @expectedExceptionMessage Cosecant function hasn't limit in the negative infinite.
22
+ */
23
+ public function testFiniteNegativeInfiniteCosec ()
24
+ {
25
+ InfiniteDecimal::getNegativeInfinite ()->cosec ();
26
+ }
27
+ }
You can’t perform that action at this time.
0 commit comments