Skip to content
This repository was archived by the owner on Dec 27, 2023. It is now read-only.

Commit 3fd528d

Browse files
committed
Moved files to be PSR-4 compliant
1 parent c7cb74a commit 3fd528d

32 files changed

+2317
-0
lines changed

src/AbelianAdditiveGroup.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace Litipk\BigNumbers;
4+
5+
/**
6+
* Immutable object that represents an element from an abelian additive group
7+
*
8+
* @author Andreu Correa Casablanca <[email protected]>
9+
*/
10+
interface AbelianAdditiveGroup
11+
{
12+
/**
13+
* Returns the element's additive inverse.
14+
*
15+
* @return AbelianAdditiveGroup
16+
*/
17+
public function additiveInverse();
18+
}

src/BigNumber.php

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?php
2+
3+
namespace Litipk\BigNumbers;
4+
5+
/**
6+
* BigNumber Interface
7+
*
8+
* @author Andreu Correa Casablanca <[email protected]>
9+
*/
10+
interface BigNumber
11+
{
12+
/**
13+
* Adds two big numbers
14+
*
15+
* @param BigNumber $b
16+
* @return BigNumber
17+
*/
18+
public function add(BigNumber $b);
19+
20+
/**
21+
* Substracts $b from $this
22+
*
23+
* @param BigNumber $b
24+
* @return BigNumber
25+
*/
26+
public function sub(BigNumber $b);
27+
28+
/**
29+
* Multiplies two big numbers
30+
*
31+
* @param BigNumber $b
32+
* @return BigNumber
33+
*/
34+
public function mul(BigNumber $b);
35+
36+
/**
37+
* Divides $this by $b
38+
*
39+
* @param BigNumber $b
40+
* @return BigNumber
41+
*/
42+
public function div(BigNumber $b);
43+
44+
/**
45+
* @return boolean
46+
*/
47+
public function isZero();
48+
49+
/**
50+
* @return boolean
51+
*/
52+
public function isPositive();
53+
54+
/**
55+
* @return boolean
56+
*/
57+
public function isNegative();
58+
59+
/**
60+
* @return boolean
61+
*/
62+
public function isInfinite();
63+
64+
/**
65+
* Says if this object is a "Not a Number"
66+
*
67+
* @return boolean
68+
*/
69+
public function isNaN();
70+
71+
/**
72+
* Equality comparison between this object and $b
73+
*
74+
* @param BigNumber $b
75+
* @return boolean
76+
*/
77+
public function equals(BigNumber $b);
78+
}

0 commit comments

Comments
 (0)